Move Saxonite’s projects into a dedicated `Workspace` folder and align the solution with .NET 10 and the current Common workspace. Update encryption integration, test project structure and coverage, and repository guidance and upgrade notes. - Relocate application and library projects while retaining Git rename history. - Split tests into Admin, Online, and Shared projects; add representative behavioral and serialization tests. - Update Common integration, application version, and repository documentation. Application version: 1.3.0 Reviewed-on: #1 Co-authored-by: andy <andy@sarand.com>
48 lines
2.1 KiB
C#
48 lines
2.1 KiB
C#
using NUnit.Framework;
|
|
using Saxonite.Net.Standard.Base.App;
|
|
using Saxonite.Net.Standard.Base.Bus;
|
|
|
|
namespace Saxonite.Net.Core.UnitTests.Data.Bus
|
|
{
|
|
//=======================================================================
|
|
[TestFixture]
|
|
public class SaxContactData_Bus_Tester
|
|
{
|
|
//-------------------------------------------------------------------
|
|
[Test]
|
|
public void ContactMethodsCanBeUpdatedRemovedAndCleared()
|
|
{
|
|
SaxContactData data = new SaxContactData();
|
|
|
|
Assert.That(data.SetContactMethodValue(Sax.ContactMethod.Email, "first@example.com"), Is.True);
|
|
Assert.That(data.SetContactMethodValue(Sax.ContactMethod.Email, "second@example.com"), Is.True);
|
|
Assert.That(data.GetContactMethodValue(Sax.ContactMethod.Email), Is.EqualTo("second@example.com"));
|
|
Assert.That(data.SetContactMethodValue(Sax.ContactMethod.Unknown, "ignored"), Is.False);
|
|
Assert.That(data.SetContactMethodValue(Sax.ContactMethod.PhoneMain, ""), Is.False);
|
|
Assert.That(data.ClearContactMethod(Sax.ContactMethod.Email), Is.True);
|
|
Assert.That(data.ClearContactMethod(Sax.ContactMethod.Email), Is.False);
|
|
|
|
data.SetContactMethodValue(Sax.ContactMethod.Website, "https://example.com");
|
|
data.SetContactMethodValue(Sax.ContactMethod.PhoneMobile, "+1 555 0100");
|
|
data.ClearContactMethods();
|
|
Assert.That(data.Methods, Is.Empty);
|
|
}
|
|
|
|
//-------------------------------------------------------------------
|
|
[Test]
|
|
public void ContactDataRoundTripsXmlValues()
|
|
{
|
|
SaxContactData data = new SaxContactData();
|
|
data.SetContactMethodValue(Sax.ContactMethod.Email, "person+tag@example.com & team");
|
|
data.SetContactMethodValue(Sax.ContactMethod.PhoneMain, "+1 555 0100");
|
|
|
|
SaxContactData restored = new SaxContactData(data.GetContactData());
|
|
|
|
Assert.That(restored.GetContactMethodValue(Sax.ContactMethod.Email), Is.EqualTo("person+tag@example.com & team"));
|
|
Assert.That(restored.GetContactMethodValue(Sax.ContactMethod.PhoneMain), Is.EqualTo("+1 555 0100"));
|
|
Assert.That(restored.Methods, Has.Count.EqualTo(2));
|
|
}
|
|
}
|
|
//=======================================================================
|
|
}
|