Exemple #1
0
        public void Restore_returnsExpected()
        {
            var add1 = "add1";

            var add3 = "ADD3";
            var add6 = "address 6";

            var expected = new AddressLines(add1, null, add3, null, null, add6);

            var sut = new AddressNameNumber(expected);

            sut.Simplify();
            sut.Address6 = "new address 6";

            sut.Restore();

            Assert.That(sut, Is.Not.Null);

            Assert.That(sut.FullAddress(), Is.EqualTo(expected.FullAddress()));
            Assert.That(sut.Address1, Is.EqualTo(add1));
            Assert.That(sut.Address2, Is.Null);
            Assert.That(sut.Address3, Is.EqualTo(add3));
            Assert.That(sut.Address4, Is.Null);
            Assert.That(sut.Address5, Is.Null);
            Assert.That(sut.Address6, Is.EqualTo(add6));
        }
Exemple #2
0
        public void RestoreEmpty_returnsExpected()
        {
            var expected = new AddressLines(null, null, null, null, null, null);

            var sut = new AddressNameNumber(expected);

            sut.Simplify();
            sut.Address6 = "new address 6";

            sut.Restore();

            Assert.That(sut, Is.Not.Null);

            Assert.That(sut.FullAddress(), Is.EqualTo(expected.FullAddress()));
            Assert.That(sut.Address1, Is.Null);
            Assert.That(sut.Address2, Is.Null);
            Assert.That(sut.Address3, Is.Null);
            Assert.That(sut.Address4, Is.Null);
            Assert.That(sut.Address5, Is.Null);
            Assert.That(sut.Address6, Is.Null);
        }
        public void AddressSimplify_HouseNumberHasPartiaNumber_HouseNameNotEmpty_ReturnsExpected()
        {
            var add1 = 21.ToString();
            var add2 = "13 name the house";
            var add3 = "ADD3";
            var add4 = "";
            var add5 = "add_5";
            var add6 = "address 6";

            var sut = new AddressNameNumber(HouseNumber: add1, houseName: add2, Street: add3, Location: add4, Town: add5, County: add6);

            sut.Simplify();

            Assert.That(sut, Is.Not.Null);
            Assert.That(sut.HouseNumber, Is.EqualTo(add1));
            Assert.That(sut.HouseName, Is.EqualTo(add2));
            Assert.That(sut.Address3, Is.EqualTo(add3));
            Assert.That(sut.Address4, Is.EqualTo(add5));
            Assert.That(sut.Address5, Is.EqualTo(add6));
            Assert.That(sut.Address6, Is.EqualTo(""));
        }
        public void AddressSimplify_HouseNumberHasNumber_HouseNameNotEmpty_ReturnsExpected()
        {
            var add1 = "13 the street";
            var add2 = 21.ToString();
            var add3 = "ADD3";
            var add4 = "";
            var add5 = "add_5";
            var add6 = "address 6";

            var sut = new AddressNameNumber(add1, add2, add3, add4, add5, add6);

            sut.Simplify();

            Assert.That(sut, Is.Not.Null);
            Assert.That(sut.HouseName, Is.EqualTo(add1));
            Assert.That(sut.HouseNumber, Is.EqualTo(add2));
            Assert.That(sut.Address3, Is.EqualTo(add3));
            Assert.That(sut.Address4, Is.EqualTo(add5));
            Assert.That(sut.Address5, Is.EqualTo(add6));
            Assert.That(sut.Address6, Is.EqualTo(""));
        }
        public void AddressSimplify_HouseNumberHasPartialNumber_ReturnsExpected()
        {
            var add1number = 21.ToString();
            var add1Name   = " the knowle";

            var add1 = add1number + add1Name;

            var add3 = "ADD3";
            var add4 = "";
            var add5 = "add_5";
            var add6 = "address 6";

            var sut = new AddressNameNumber(add1, null, add3, add4, add5, add6);

            sut.Simplify();

            Assert.That(sut, Is.Not.Null);
            Assert.That(sut.HouseName, Is.EqualTo(add1Name.Trim()));
            Assert.That(sut.HouseNumber, Is.EqualTo(add1number));
            Assert.That(sut.Address3, Is.EqualTo(add3));
            Assert.That(sut.Address4, Is.EqualTo(add5));
            Assert.That(sut.Address5, Is.EqualTo(add6));
            Assert.That(sut.Address6, Is.EqualTo(""));
        }