Esempio n. 1
0
        public void RetrieveExistingWithAddress()
        {
            //-- Arrange
            var customerRepositorty = new CustomerRepositry();
            var expected            = new Customer(1)
            {
                EmailAddress = "*****@*****.**",
                FirstName    = "Steve",
                LastName     = "Jobs",
                AddressList  = new List <Address>()
                {
                    new Address()
                    {
                        AddressType = 1,
                        StreetLine1 = "Bag End",
                        StreetLine2 = "Bagshot row",
                        City        = "Hobbiton",
                        State       = "Shire",
                        Country     = "Middle Earth",
                        PostalCode  = "144"
                    },
                    new Address()
                    {
                        AddressType = 2,
                        StreetLine1 = "Green Dragon",
                        City        = "Bywater",
                        State       = "Shire",
                        Country     = "Middle Earth",
                        PostalCode  = "146"
                    }
                }
            };


            //-- Act
            var actual = customerRepositorty.Retrieve(1);

            //-- Assert
            Assert.AreEqual(expected.CustomerId, actual.CustomerId);
            Assert.AreEqual(expected.EmailAddress, actual.EmailAddress);
            Assert.AreEqual(expected.FirstName, actual.FirstName);
            Assert.AreEqual(expected.LastName, actual.LastName);

            for (int i = 0; i < 1; i++)
            {
                Assert.AreEqual(expected.AddressList[i].AddressType, actual.AddressList[i].AddressType);
                Assert.AreEqual(expected.AddressList[i].StreetLine1, actual.AddressList[i].StreetLine1);
                Assert.AreEqual(expected.AddressList[i].City, actual.AddressList[i].City);
                Assert.AreEqual(expected.AddressList[i].State, actual.AddressList[i].State);
                Assert.AreEqual(expected.AddressList[i].Country, actual.AddressList[i].Country);
                Assert.AreEqual(expected.AddressList[i].PostalCode, actual.AddressList[i].PostalCode);
            }
        }
Esempio n. 2
0
        public void RetrieveExisting()
        {
            //-- Arrange
            var customerRepository = new CustomerRepositry();
            var expected           = new Customer(1)
            {
                EmailAddress = "*****@*****.**",
                FirstName    = "Steve",
                LastName     = "Jobs"
            };

            //-- Act
            var actual = customerRepository.Retrieve(1);

            //-- Assert
            //Assert.AreEqual(expected, actual);

            Assert.AreEqual(expected.CustomerId, actual.CustomerId);
            Assert.AreEqual(expected.EmailAddress, actual.EmailAddress);
            Assert.AreEqual(expected.FirstName, actual.FirstName);
            Assert.AreEqual(expected.LastName, actual.LastName);
        }