From a30a8b1822c651f5fd0340d18dd0a3af46c0365b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Hoffmann?= Date: Fri, 6 Jan 2023 22:57:07 +0100 Subject: [PATCH] Add Tests to fix #43 and #48 --- Gedcomx.Model/Collections/Emails.cs | 18 ++++++++++++++++++ Gedcomx.Model/Collections/TextValues.cs | 24 ++++++++++++++++++++++++ 2 files changed, 42 insertions(+) create mode 100644 Gedcomx.Model/Collections/Emails.cs create mode 100644 Gedcomx.Model/Collections/TextValues.cs diff --git a/Gedcomx.Model/Collections/Emails.cs b/Gedcomx.Model/Collections/Emails.cs new file mode 100644 index 0000000..22fc8e5 --- /dev/null +++ b/Gedcomx.Model/Collections/Emails.cs @@ -0,0 +1,18 @@ +using System.Collections.Generic; + +using Gx.Common; + +namespace Gx.Model.Collections +{ + /// + /// A list of reference to Emails resources. + /// + public class Emails : List + { + /// + /// Add an email. + /// + /// The address to add. + public void Add(string email) => this.Add(new ResourceReference("mailto:" + email)); + } +} diff --git a/Gedcomx.Model/Collections/TextValues.cs b/Gedcomx.Model/Collections/TextValues.cs new file mode 100644 index 0000000..fe4fa71 --- /dev/null +++ b/Gedcomx.Model/Collections/TextValues.cs @@ -0,0 +1,24 @@ +using System.Collections.Generic; +using System.Linq; + +using Gx.Common; + +namespace Gx.Model.Collections +{ + /// + /// A list of text values. + /// + public class TextValues : List + { + /// + /// Add a name. + /// + /// The name. + public void Add(string name) => Add(new TextValue(name)); + + /// + /// Check if List is filled: + /// + public bool Safe { get { return !(this?.Any() ?? false); } } + } +}