public void Predecessor_ValidInput_ReturnsCorrectPostalCode(string postalCode, string postalCodePredecessor) { var code = new GBPostalCode(postalCode); var codePredecessor = new GBPostalCode(postalCodePredecessor); Assert.AreEqual(codePredecessor, code.Predecessor); Assert.AreEqual(codePredecessor.ToString(), code.Predecessor.ToString()); Assert.AreEqual(codePredecessor.ToHumanReadableString(), code.Predecessor.ToHumanReadableString()); }
public void Successor_ValidInput_ReturnsCorrectPostalCode(string postalCode, string postalCodeSuccessor) { var curr = new GBPostalCode(postalCode); var succ = curr.Successor; Assert.AreEqual(postalCodeSuccessor, succ.ToString()); Assert.IsTrue(curr <= succ); Assert.IsTrue(curr < succ); }
public void Predecessor_ValidInput_ReturnsCorrectPostalCode(string postalCode, string postalCodePredecessor) { var curr = new GBPostalCode(postalCode); var prev = curr.Predecessor; Assert.AreEqual(postalCodePredecessor, prev.ToString()); Assert.IsTrue(curr >= prev); Assert.IsTrue(curr > prev); }
public void PostalCodeFormatsMatch(string code1, string code2, bool expectedMatch) { Assert.AreEqual(expectedMatch, GBPostalCode.HasSameFormat(code1, code2)); }
public void AreAdjacent_WithAdjacentPostalCodes_ReturnsTrue(string code) { var x = new GBPostalCode(code); var xPred = x.Predecessor; var xSucc = x.Successor; Assert.IsTrue(PostalCode.AreAdjacent(x, xPred)); Assert.IsTrue(PostalCode.AreAdjacent(xPred, x)); Assert.IsTrue(PostalCode.AreAdjacent(x, xSucc)); Assert.IsTrue(PostalCode.AreAdjacent(xSucc, x)); Assert.IsFalse(PostalCode.AreAdjacent(xPred, xSucc)); }
public void GetHashCode_WithEqualObject_EqualHashes(string code) { var x = new GBPostalCode(code); var y = new GBPostalCode(code); Assert.IsTrue(x.GetHashCode() == y.GetHashCode()); }