Ejemplo n.º 1
0
        public void GetHashCode_WithEqualObject_EqualHashes(string code)
        {
            var x = new EEPostalCode(code);
            var y = new EEPostalCode(code);

            Assert.IsTrue(x.GetHashCode() == y.GetHashCode());
        }
 public void Predecessor_ValidInput_ReturnsCorrectPostalCode(string postalCode, string postalCodePredecessor)
 {
     var code = new EEPostalCode(postalCode);
     var codePredecessor = new EEPostalCode(postalCodePredecessor);
     Assert.AreEqual(codePredecessor, code.Predecessor);
     Assert.AreEqual(codePredecessor.ToString(), code.Predecessor.ToString());
     Assert.AreEqual(codePredecessor.ToHumanReadableString(), code.Predecessor.ToHumanReadableString());
 }
Ejemplo n.º 3
0
        public void CompareTo_ReturnsExpectedSign(string postalCodeBefore, string postalCodeAfter)
        {
            var b = new EEPostalCode(postalCodeBefore);
            var a = new EEPostalCode(postalCodeAfter);

            Assert.AreEqual(Math.Sign(-1), Math.Sign(b.CompareTo(a)));
            Assert.AreEqual(Math.Sign(1), Math.Sign(a.CompareTo(b)));
        }
Ejemplo n.º 4
0
        public void Successor_ValidInput_ReturnsCorrectPostalCode(string postalCode, string postalCodeSuccessor)
        {
            var code          = new EEPostalCode(postalCode);
            var codeSuccessor = new EEPostalCode(postalCodeSuccessor);

            Assert.AreEqual(codeSuccessor, code.Successor);
            Assert.AreEqual(codeSuccessor.ToString(), code.Successor.ToString());
            Assert.AreEqual(codeSuccessor.ToHumanReadableString(), code.Successor.ToHumanReadableString());
        }
Ejemplo n.º 5
0
        public void AreAdjacent_WithAdjacentPostalCodes_ReturnsTrue(string code)
        {
            var x     = new EEPostalCode(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 AreAdjacent_WithAdjacentPostalCodes_ReturnsTrue(string code)
 {
     var x = new EEPostalCode(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 EEPostalCode(code);
     var y = new EEPostalCode(code);
     Assert.IsTrue(x.GetHashCode() == y.GetHashCode());
 }