public void NewEmptyUsrnIsNotNull() { //Check that reference isn't empty var sut = new Usrn(); Assert.NotNull(sut); }
public void UsrnisIusrn() { //Test to see if USRN is an instance of IUSRN var sut = new Usrn(); Assert.That(sut, Is.InstanceOf(typeof(IUsrn))); }
public void EmptyValueGivesIsValidFalse() { //Test to ensure an empty value is recorded as not being a valid result var sut = new Usrn(); var actual = sut.IsValid(); Assert.False(actual); }
public void ConstructorAcceptsLong() { //Check that long values are accepted long test = 1234; var sut = new Usrn(test); Assert.NotNull(sut); }
public void EmptyValueIsEmpty() { //Test to ensure no other value is returned if nothing is passed var sut = new Usrn(); var actual = sut.IsEmpty(); Assert.AreEqual(actual, true); }
public void DefaultIsRecognised() { var input = new Usrn(); var actual = input.IsDefault(); Assert.That(actual, Is.True); }
public void ValidUsrnIsValid() { var input = new Usrn(123); var actual = input.IsValid(); Assert.That(actual, Is.True); }
public void ValidUsrnIsNotDefault() { var input = new Usrn(123); var actual = input.IsDefault(); Assert.That(actual, Is.False); }
public void InvalidStringIsValidFalse([Values("abc", "def", "!$%^")] string value) { var sut = new Usrn(value); var actual = sut.IsValid(); Assert.False(actual); }
public void InvalidStringIsEmpty([Values("abc", "def", "!$$%")] string value) { var sut = new Usrn(value); var actual = sut.IsEmpty(); Assert.True(actual); }
public void UsrnHasCorrectValue() { //Check to see the USRN contains a correct value, and this is passed correctly long expected = 12345; var sut = new Usrn(expected); var actual = sut.Value; Assert.AreEqual(actual, expected); }
public void NonEmptyValueIsNotEmpty() { //Test to ensure that any passed value that isn't empty is recorded as not being empty const long value = 12345; var sut = new Usrn(value); var actual = sut.IsEmpty(); Assert.AreEqual(actual, false); }
public void WierdLongValuesAreNotValid([Values(-1, 0, 01234567890123)] long input) { var usrn = new Usrn(input); var actual = usrn.IsValidUsrn(input); Assert.That(actual, Is.False); }
public void ConstructorAcceptsString([Values("hello world", "12345", "Sample", "!£$$^&*():")] string test) { //Check that string values are accepted var sut = new Usrn(test); Assert.NotNull(sut); }
public void UsrnIsInequal( [Values(1, 2, 3)] int x, [Values("", "12")] string s) { var numUsrn = new Usrn(x); var stringUsrn = new Usrn(s); var actual = numUsrn != stringUsrn; Assert.That(actual, Is.True); }
public void SensibleStringValuesAreValid([Values("1", "8090", "012345678901", " 23 ")] string input) { var usrn = new Usrn(input); var actual = usrn.IsValidUsrn(input); Assert.That(actual, Is.True); }
public void SensibleLongValuesAreValid([Values(1, 8090, 012345678901, 23)] long input) { var usrn = new Usrn(input); var actual = usrn.IsValidUsrn(input); Assert.That(actual, Is.True); }
public void WierdValuesAreNotValid([Values("", "-1", "01234567890123", "e", "uprn", " 0.12")] string input) { var usrn = new Usrn(input); var actual = usrn.IsValidUsrn(input); Assert.That(actual, Is.False); }
public void UsrnIsNotEqual( [Values(1, 2, 3)] int x, [Values("", "12")] string s) { var numUsrn = new Usrn(x); var stringUsrn = new Usrn(s); var actual = numUsrn == stringUsrn; Assert.That(actual, Is.False); Assert.That(numUsrn, Is.Not.EqualTo(stringUsrn)); }
public void AssignedZeroOrNegativeUprnValueIsNull([Values(0, -1, -300)] int usrn) { var sut = new Usrn { Value = usrn }; var actual = sut.Value; long?expected = sut.NullUsrnValue; Assert.That(actual, Is.EqualTo(expected)); }
/// <inheritdoc /> public bool ValidUsrn(long usrn) { var _usrn = new Usrn(usrn); return(_usrn.IsValid()); }
public void CanSerialiseContact() { var title = "title"; var surname = "surname"; var forename = "forename"; var person = new Person { Title = title, Surname = surname, Forename = forename }; var address1 = "add1"; var address2 = "add2"; var address3 = "add3"; var address4 = "add4"; var address5 = "add5"; var uprn = new Uprn("12345"); var usrn = new Usrn(); var address = new Address(address1, address2, address3, address4, address5, null) { Uprn = uprn, Usrn = usrn }; var mobile = new TelephoneNumber("123"); var preferred = new TelephoneNumber("789"); var sut = new Contact { Address = address, HomePhone = new TelephoneNumber(), MobilePhone = new TelephoneNumber("123"), Person = person, PreferredPhone = new TelephoneNumber("789") }; var serialised = sut.ToJson(); Assert.That(serialised, Is.Not.Null.Or.Empty); Assert.That(serialised.Length, Is.GreaterThan(40)); var deserialised = serialised.FromJson <Contact>(); Assert.That(deserialised, Is.Not.Null.Or.Empty); Assert.That(deserialised.Person, Is.Not.Null); Assert.That(deserialised.Person.Title, Is.EqualTo(title)); Assert.That(deserialised.Person.GivenName, Is.EqualTo(forename)); Assert.That(deserialised.Person.FamilyName, Is.EqualTo(surname)); Assert.That(deserialised.Address, Is.Not.Null.Or.Empty); var actualAddress = deserialised.Address; Assert.That(actualAddress.Address1, Is.EqualTo(address1)); Assert.That(actualAddress.Address2, Is.EqualTo(address2)); Assert.That(actualAddress.Address3, Is.EqualTo(address3)); Assert.That(actualAddress.Address4, Is.EqualTo(address4)); Assert.That(actualAddress.Address5, Is.EqualTo(address5)); Assert.That(actualAddress.Uprn, Is.Not.Null); Assert.That(actualAddress.Uprn.Value.ToString(), Is.EqualTo(uprn.Value.ToString())); Assert.That(deserialised.PreferredPhone, Is.Not.Null.Or.Empty); Assert.That(deserialised.PreferredPhone.Value, Is.EqualTo(preferred.Value)); Assert.That(deserialised.MobilePhone, Is.Not.Null.Or.Empty); Assert.That(deserialised.MobilePhone.Value, Is.EqualTo(mobile.Value)); }