public void ToXmlTest() { var list = XrcdlDocument.Create().GetMetadata().Contacts; AppendInfo(list); Assert.AreEqual(Resources.ToXmlResult, list.Document.ToXml()); }
private static void ConverterTestCore() { var list = XrcdlDocument.Create().GetMetadata().Contacts; AppendInfo(list); Assert.AreEqual(Resources.HtmlConverterResult, list.ConvertToHtml()); }
public void CreateTest() { var obj = XrcdlDocument.Create(); Assert.IsNotNull(obj, nameof(obj)); var meta = obj.GetMetadata(); Assert.IsNotNull(meta, nameof(meta)); var list = meta.Contacts; Assert.IsNotNull(list, nameof(list)); }
public void AppendTest() { var list1 = XrcdlDocument.Create()?.GetMetadata()?.Contacts; Assert.IsNotNull(list1, nameof(list1)); var list2 = list1 !; // suppress warnings // Address var addr = list2.AppendAddressInfo("ABCDEF", 1234); Assert.IsNotNull(addr, nameof(addr)); Assert.AreEqual("ABCDEF", addr.Address); Assert.AreEqual(1234, addr.PostCode); // Email var mail = list2.AppendEmailInfo("*****@*****.**", "件名", "本文"); Assert.IsNotNull(mail, nameof(mail)); Assert.AreEqual("*****@*****.**", mail.Address); Assert.AreEqual("件名", mail.Subject); Assert.AreEqual("本文", mail.Body); // Phone var tel = list2.AppendTelInfo("123-456-789"); var fax = list2.AppendFaxInfo("456(789)123"); var sms = list2.AppendSmsInfo("789+123+456"); // test for '+' Assert.IsNotNull(tel, nameof(tel)); Assert.IsNotNull(fax, nameof(fax)); Assert.IsNotNull(sms, nameof(sms)); Assert.AreEqual(XrcdlPhoneNumberType.Telephone, tel.Type); Assert.AreEqual(XrcdlPhoneNumberType.Facsimile, fax.Type); Assert.AreEqual(XrcdlPhoneNumberType.ShortMessageService, sms.Type); tel.Normalize(); fax.Normalize(); sms.Normalize(); Assert.AreEqual("123-456-789", tel.Number); Assert.AreEqual("456(789)123", fax.Number); Assert.AreEqual("789+123+456", sms.Number); // Invalid Phone var inv = list2.AppendTelInfo("aaa"); Assert.IsNotNull(inv, nameof(inv)); Assert.AreEqual(XrcdlPhoneNumberType.Telephone, inv.Type); Assert.AreEqual("aaa", inv.Number); Assert.IsFalse(inv.Validate()); // Link var link = list2.AppendLinkInfo(new Uri("https://example.com/abcxyx/hello/world"), "Hello, World!!"); Assert.IsNotNull(link, nameof(link)); Assert.AreEqual("https://example.com/abcxyx/hello/world", link.Link.OriginalString); Assert.AreEqual("Hello, World!!", link.Title); // SNS var sns = list2.AppendSocialAccountInfo("foobar", new Uri("https://hoge.example.com/user/"), "FugaPiyo"); Assert.IsNotNull(sns, nameof(sns)); Assert.AreEqual("foobar", sns.AccountName); Assert.AreEqual("https://hoge.example.com/user/", sns.UriPrefix.OriginalString); Assert.AreEqual("FugaPiyo", sns.ServiceName); Assert.IsTrue(list2.Contains(addr), nameof(addr)); Assert.IsTrue(list2.Contains(mail), nameof(mail)); Assert.IsTrue(list2.Contains(tel), nameof(tel)); Assert.IsTrue(list2.Contains(fax), nameof(fax)); Assert.IsTrue(list2.Contains(sms), nameof(sms)); Assert.IsTrue(list2.Contains(inv), nameof(inv)); Assert.IsTrue(list2.Contains(link), nameof(link)); Assert.IsTrue(list2.Contains(sns), nameof(sns)); }
public void CreateTest() { var obj = XrcdlDocument.Create(); Assert.IsNotNull(obj); }