Example #1
0
        public void ConstructorTest()
        {
            var builder = new AddressBuilder().SetStreet("One Main Street").SetCity("Seattle").SetState("WA").SetZip("98117").SetCountry("USA");
            var address = builder.Build();

            Helper.AssertAreEqual(builder, address);
        }
Example #2
0
        public void ToStringTest()
        {
            var builder = new AddressBuilder().SetName("Joe Schmoe").SetStreet("Five State Street").SetCity("Seattle").SetState("WA").SetZip("98117").SetCountry("USA");
            var address = builder.Build();

            Assert.AreEqual(builder.ToString(), address.ToString());
        }
        public void AddExistingAddressTest()
        {
            var addressBookBuilder = new AddressBookBuilder();
            var addressBook        = addressBookBuilder.Build();

            var addressBuilders = addressBookBuilder.GetAddressBuilders();

            var addressBuilder = new AddressBuilder();
            var name           = "New address name";

            addressBuilders.Add(name, addressBuilder);
            addressBook.Add(addressBuilder.Build());

            Helper.AssertAreEqual(addressBookBuilder, addressBook, "Before");

            addressBook.Add(addressBuilder.Build());

            Helper.AssertAreEqual(addressBookBuilder, addressBook, "After");
        }
Example #4
0
        public void SetZipTest()
        {
            var builder = new AddressBuilder().SetZip("Before");
            var address = builder.Build();

            Helper.AssertAreEqual(builder, address, "Before");

            var zip = "12345";

            builder.SetZip(zip);
            address.Zip = zip;

            Helper.AssertAreEqual(builder, address, "After");
        }
Example #5
0
        public void SetStateTest()
        {
            var builder = new AddressBuilder().SetState("Before");
            var address = builder.Build();

            Helper.AssertAreEqual(builder, address, "Before");

            var state = "WA";

            builder.SetState(state);
            address.State = state;

            Helper.AssertAreEqual(builder, address, "After");
        }
Example #6
0
        public void SetCityTest()
        {
            var builder = new AddressBuilder().SetCity("Before");
            var address = builder.Build();

            Helper.AssertAreEqual(builder, address, "Before");

            var city = "Post Falls";

            builder.SetCity(city);
            address.City = city;

            Helper.AssertAreEqual(builder, address, "After");
        }
Example #7
0
        public void SetStreetTest()
        {
            var builder = new AddressBuilder().SetStreet("Before");
            var address = builder.Build();

            Helper.AssertAreEqual(builder, address, "Before");

            var street = "123 Main";

            builder.SetStreet(street);
            address.Street = street;

            Helper.AssertAreEqual(builder, address, "After");
        }
Example #8
0
        public void SetCountryTest()
        {
            var builder = new AddressBuilder().SetCountry("Before");
            var address = builder.Build();

            Helper.AssertAreEqual(builder, address, "Before");

            var country = "Mexico";

            builder.SetCountry(country);
            address.Country = country;

            Helper.AssertAreEqual(builder, address, "After");
        }
        public void UpdateKeyDoesNotExistTest()
        {
            var addressBookBuilder = new AddressBookBuilder();
            var addressBook        = addressBookBuilder.Build();

            var addressBuilders = addressBookBuilder.GetAddressBuilders();

            var addressBuilder = new AddressBuilder();
            var name           = "Sally";

            addressBuilders.Add(name, addressBuilder);
            addressBook.Add(addressBuilder.Build());

            Helper.AssertAreEqual(addressBookBuilder, addressBook, "Before");

            addressBook.Update(name, "foo", "bar");
        }