Beispiel #1
0
        public void RetrieveOrderDisplayTest()
        {
            //Arrange
            var orderRepository = new OrderRepository();
            var expected        = new OrderDisplay()
            {
                FirstName       = "Zelimir",
                LastName        = "Ilic",
                OrderDate       = new DateTimeOffset(2018, 2, 14, 10, 00, 00, new TimeSpan(1, 0, 0)),
                ShippingAddress = new Address()
                {
                    AddressType = 1,
                    StreetLine1 = "Majke Jevrosime bb",
                    StreetLine2 = "selo Zuce",
                    City        = "Beograd",
                    State       = "Srbija",
                    PostalCode  = "11000",
                    Country     = "Srbija"
                },
                OrderDisplayItemList = new List <OrderDisplayItem>()
                {
                    new OrderDisplayItem()
                    {
                        OrderQuantity = 2,
                        ProductName   = "Tulips",
                        PurchasePrice = 12.54M
                    },
                    new OrderDisplayItem()
                    {
                        OrderQuantity = 1,
                        ProductName   = "Raketa",
                        PurchasePrice = 6M
                    }
                }
            };


            //Act
            var actual = orderRepository.RetrieveOrderDisplay(10);

            Assert.AreEqual(expected.FirstName, actual.FirstName);
            Assert.AreEqual(expected.LastName, actual.LastName);
            Assert.AreEqual(expected.OrderDate, actual.OrderDate);

            Assert.AreEqual(expected.ShippingAddress.AddressType, actual.ShippingAddress.AddressType);
            Assert.AreEqual(expected.ShippingAddress.StreetLine1, actual.ShippingAddress.StreetLine1);
            Assert.AreEqual(expected.ShippingAddress.City, actual.ShippingAddress.City);
            Assert.AreEqual(expected.ShippingAddress.State, actual.ShippingAddress.State);
            Assert.AreEqual(expected.ShippingAddress.PostalCode, actual.ShippingAddress.PostalCode);
            Assert.AreEqual(expected.ShippingAddress.Country, actual.ShippingAddress.Country);

            for (int i = 0; i < 1; i++)
            {
                Assert.AreEqual(expected.OrderDisplayItemList[i].OrderQuantity, actual.OrderDisplayItemList[i].OrderQuantity);
                Assert.AreEqual(expected.OrderDisplayItemList[i].ProductName, actual.OrderDisplayItemList[i].ProductName);
                Assert.AreEqual(expected.OrderDisplayItemList[i].PurchasePrice, actual.OrderDisplayItemList[i].PurchasePrice);
            }

            //Assert
        }
Beispiel #2
0
        public void RetrieveOrderDisplayTest()
        {
            // Arrange
            var orderRepository = new OrderRepository();
            var expected        = new OrderDisplay()
            {
                FirstName       = "Bilbo",
                LastName        = "Baggins",
                OrderDate       = new DateTimeOffset(2014, 4, 14, 10, 00, 00, new TimeSpan(7, 0, 0)),
                ShippingAddress = new Address()
                {
                    AddressType = 1,
                    StreetLine1 = "Bag End",
                    StreetLine2 = "Bagshot Row",
                    City        = "Hobbiton",
                    State       = "Shire",
                    Country     = "Middle Earth",
                    PostalCode  = "144"
                },
                OrderDisplayItemList = new List <OrderDisplayItem>()
                {
                    new OrderDisplayItem()
                    {
                        OrderQuantity = 2,
                        ProductName   = "Sunflowers",
                        PurchasePrice = 15.96M
                    },
                    new OrderDisplayItem()
                    {
                        OrderQuantity = 1,
                        ProductName   = "Rake",
                        PurchasePrice = 6M
                    }
                }
            };

            // Act
            var actual = orderRepository.RetrieveOrderDisplay(10);

            // Assert
            Assert.AreEqual(expected.FirstName, actual.FirstName);
            Assert.AreEqual(expected.LastName, actual.LastName);
            Assert.AreEqual(expected.OrderDate, actual.OrderDate);

            Assert.AreEqual(expected.ShippingAddress.AddressType, actual.ShippingAddress.AddressType);
            Assert.AreEqual(expected.ShippingAddress.StreetLine1, actual.ShippingAddress.StreetLine1);
            Assert.AreEqual(expected.ShippingAddress.City, actual.ShippingAddress.City);
            Assert.AreEqual(expected.ShippingAddress.State, actual.ShippingAddress.State);
            Assert.AreEqual(expected.ShippingAddress.Country, actual.ShippingAddress.Country);
            Assert.AreEqual(expected.ShippingAddress.PostalCode, actual.ShippingAddress.PostalCode);



            for (int i = 0; i < 1; i++)
            {
                Assert.AreEqual(expected.OrderDisplayItemList[i].OrderQuantity, actual.OrderDisplayItemList[i].OrderQuantity);
                Assert.AreEqual(expected.OrderDisplayItemList[i].ProductName, actual.OrderDisplayItemList[i].ProductName);
                Assert.AreEqual(expected.OrderDisplayItemList[i].PurchasePrice, actual.OrderDisplayItemList[i].PurchasePrice);
            }
        }
Beispiel #3
0
        public void RetrieveOrderDisplayTest()
        {
            //Arrange
            var orderRepository = new OrderRepository();
            var expected        = new OrderDisplay()
            {
                FirstName       = "Duc",
                LastName        = "Mai",
                OrderDate       = new DateTimeOffset(2019, 2, 28, 23, 0, 0, TimeSpan.FromHours(+3)),
                ShippingAddress = new Address()
                {
                    AddressType = 1,
                    StreetLine1 = "Bag End",
                    StreetLine2 = "Bagshot row",
                    City        = "Quincy",
                    State       = "MA",
                    Country     = "United States",
                    PostalCode  = "02169"
                },
                orderDisplayItemList = new List <OrderDisplayItem>()
                {
                    new OrderDisplayItem()
                    {
                        OrderQuantity = 2,
                        ProductName   = "Sunflowers",
                        PurchasePrice = 15.9M
                    },
                    new OrderDisplayItem()
                    {
                        OrderQuantity = 1,
                        ProductName   = "Rake",
                        PurchasePrice = 6M
                    }
                }
            };

            //Act
            var actual = orderRepository.RetrieveOrderDisplay(10);

            //Assert
            Assert.AreEqual(expected.FirstName, actual.FirstName);
            Assert.AreEqual(expected.LastName, actual.LastName);
            Assert.AreEqual(expected.OrderDate, actual.OrderDate);
            Assert.AreEqual(expected.ShippingAddress.AddressType, actual.ShippingAddress.AddressType);
            Assert.AreEqual(expected.ShippingAddress.StreetLine1, actual.ShippingAddress.StreetLine1);
            Assert.AreEqual(expected.ShippingAddress.StreetLine2, actual.ShippingAddress.StreetLine2);
            Assert.AreEqual(expected.ShippingAddress.City, actual.ShippingAddress.City);
            Assert.AreEqual(expected.ShippingAddress.State, actual.ShippingAddress.State);
            Assert.AreEqual(expected.ShippingAddress.Country, actual.ShippingAddress.Country);
            Assert.AreEqual(expected.ShippingAddress.PostalCode, actual.ShippingAddress.PostalCode);
            for (int i = 0; i < 1; i++)
            {
                Assert.AreEqual(expected.orderDisplayItemList[i].ProductName, actual.orderDisplayItemList[i].ProductName);
                Assert.AreEqual(expected.orderDisplayItemList[i].OrderQuantity, actual.orderDisplayItemList[i].OrderQuantity);
                Assert.AreEqual(expected.orderDisplayItemList[i].PurchasePrice, actual.orderDisplayItemList[i].PurchasePrice);
            }
        }
Beispiel #4
0
        public void RetrieveOrderDiplayTest()
        {
            //arrange
            var orderRepository = new OrderRepository();
            var expected        = new OrderDisplay()
            {
                FirstName       = "Glenn",
                LastName        = "Danzig",
                OrderDate       = new DateTimeOffset(2018, 4, 14, 10, 00, 00, new TimeSpan(7, 0, 0)),
                ShippingAddress = new Address()
                {
                    AddressType = 1,
                    StreetLine1 = "Kitten Town",
                    StreetLine2 = "Kitten Circle",
                    City        = "Hoboken",
                    State       = "New Jersey",
                    Country     = "United States",
                    PostalCode  = "666"
                },
                orderDisplayItemList = new List <OrderDisplayItem>()
                {
                    new OrderDisplayItem()
                    {
                        ProductName   = "Sure Step Kitty Litter",
                        PurchasePrice = 16.99M,
                        OrderQuantity = 2
                    },
                    new OrderDisplayItem()
                    {
                        ProductName   = "Litter Box Scooper",
                        PurchasePrice = 6M,
                        OrderQuantity = 1
                    }
                }
            };
            //act
            var actual = orderRepository.RetrieveOrderDisplay(10);

            //assert
            Assert.AreEqual(expected.FirstName, actual.FirstName);
            Assert.AreEqual(expected.LastName, actual.LastName);
            Assert.AreEqual(expected.OrderDate, actual.OrderDate);

            Assert.AreEqual(expected.ShippingAddress.AddressType, actual.ShippingAddress.AddressType);
            Assert.AreEqual(expected.ShippingAddress.StreetLine1, actual.ShippingAddress.StreetLine1);
            Assert.AreEqual(expected.ShippingAddress.City, actual.ShippingAddress.City);
            Assert.AreEqual(expected.ShippingAddress.State, actual.ShippingAddress.State);
            Assert.AreEqual(expected.ShippingAddress.Country, actual.ShippingAddress.Country);
            Assert.AreEqual(expected.ShippingAddress.PostalCode, actual.ShippingAddress.PostalCode);

            for (int i = 0; i < 1; i++)
            {
                Assert.AreEqual(expected.orderDisplayItemList[i].OrderQuantity, actual.orderDisplayItemList[i].OrderQuantity);
                Assert.AreEqual(expected.orderDisplayItemList[i].ProductName, actual.orderDisplayItemList[i].ProductName);
                Assert.AreEqual(expected.orderDisplayItemList[i].PurchasePrice, actual.orderDisplayItemList[i].PurchasePrice);
            }
        }
Beispiel #5
0
        public void RetrieveOrderDisplayInvalidTest()
        {
            var orderRepo = new OrderRepository();
            var expected  = new OrderDisplay()
            {
                FirstName       = "Bilbo",
                LastName        = "Baggins",
                OrderDate       = new DateTimeOffset(2014, TimeSpan.Zero),
                ShippingAddress = new Address()
                {
                    AddressType = 1,
                    StreetLine1 = "Bagnd",
                    StreetLine2 = "Bagshot row",
                    City        = "Hobiton",
                    State       = "Shire",
                    Country     = "Middle Earth",
                    PostalCode  = "1444"
                },

                OrderDisplayItemList = new List <OrderDisplayItem>()
                {
                    new OrderDisplayItem()
                    {
                        ProductName       = "Sunflowers",
                        PurchasePrice     = 15.95M,
                        OrderItemQuantity = 2
                    },
                    new OrderDisplayItem()
                    {
                        ProductName       = "Rakes",
                        PurchasePrice     = 6M,
                        OrderItemQuantity = 1
                    },
                }
            };

            var actual = orderRepo.RetrieveOrderDisplay(10);

            Assert.AreNotEqual(expected, actual);
        }
Beispiel #6
0
        public void RetrieveOrderDisplayTest()
        {
            //Arrange
            OrderDisplay expected = new OrderDisplay()
            {
                FirstName       = "Zebby",
                ShippingAddress = new Address()
                {
                    AddressType = 1,
                    StreetLine1 = "27 Lakeside Dr"
                },
                orderDisplayItemList = new List <OrderDisplayItem>()
                {
                    new OrderDisplayItem()
                    {
                        ProductName   = "Sunflowers",
                        OrderQuantity = 5
                    },

                    new OrderDisplayItem()
                    {
                        ProductName   = "Cakes",
                        OrderQuantity = 6
                    }
                }
            };

            //Act
            OrderRepository orderRepository = new OrderRepository();
            OrderDisplay    actual          = orderRepository.RetrieveOrderDisplay(10);

            //Assert
            for (int i = 0; i < actual.orderDisplayItemList.ToArray().Length; i++)
            {
                Assert.AreEqual(expected.orderDisplayItemList[i].ProductName, actual.orderDisplayItemList[i].ProductName);
                Assert.AreEqual(expected.orderDisplayItemList[i].OrderQuantity, actual.orderDisplayItemList[i].OrderQuantity);
            }
        }
Beispiel #7
0
        public void RetrieveOrderDisplayTest()
        {
            // Arrange
            var orderRepository = new OrderRepository();
            var expected        = new OrderDisplay()
            {
                FirstName       = "Bilbo",
                LastName        = "Baggins",
                OrderDate       = new DateTimeOffset(2015, 7, 29, 10, 00, 00, new TimeSpan()),
                ShippingAddress = new Address()
                {
                    AddressType = 1,
                    StreetLine1 = "Bag End",
                    StreetLine2 = "Bagshot Row",
                    City        = "Hobbiton",
                    State       = "Shire",
                    Country     = "Middle Earth",
                    PostalCode  = "144"
                },
                orderDisplayItemList = new List <OrderDisplayItem>()
                {
                    new OrderDisplayItem()
                    {
                        ProductName   = "Sunflowers",
                        PurchasePrice = 15.96M,
                        OrderQuantity = 2
                    },
                    new OrderDisplayItem()
                    {
                        ProductName   = "Rake",
                        PurchasePrice = 6M,
                        OrderQuantity = 1
                    }
                }
            };

            // Actual
            // *Had fun with this one.  Good bug hunting experience.
            // OrderRepository above was set as = new OrderDisplay();
            // *Below was unable to locate the reference orderRepository.???
            // *Now corrected to be var orderRepository = new OrderRepository();
            // #RememberingTheGoodTimes!
            var actual = orderRepository.RetrieveOrderDisplay(10);

            // Assertion
            Assert.AreEqual(expected.FirstName, actual.FirstName);
            Assert.AreEqual(expected.LastName, actual.LastName);
            Assert.AreEqual(expected.OrderDate, actual.OrderDate);

            Assert.AreEqual(expected.ShippingAddress.AddressType, actual.ShippingAddress.AddressType);
            Assert.AreEqual(expected.ShippingAddress.StreetLine1, actual.ShippingAddress.StreetLine1);
            Assert.AreEqual(expected.ShippingAddress.City, actual.ShippingAddress.City);
            Assert.AreEqual(expected.ShippingAddress.State, actual.ShippingAddress.State);
            Assert.AreEqual(expected.ShippingAddress.Country, actual.ShippingAddress.Country);
            Assert.AreEqual(expected.ShippingAddress.PostalCode, actual.ShippingAddress.PostalCode);

            for (int i = 0; i < 1; i++)
            {
                Assert.AreEqual(expected.orderDisplayItemList[i].OrderQuantity, actual.orderDisplayItemList[i].OrderQuantity);
                Assert.AreEqual(expected.orderDisplayItemList[i].ProductName, actual.orderDisplayItemList[i].ProductName);
                Assert.AreEqual(expected.orderDisplayItemList[i].PurchasePrice, actual.orderDisplayItemList[i].PurchasePrice);
            }
        }