Esempio n. 1
0
        public void SaveTestMissingLastName()
        {
            //Arrange
            var orderRepository = new OrderRepository();
            var updateOrder     = new Order(10);

            updateOrder.HasChanges = true;
            //Act
            var actual = orderRepository.Save(updateOrder);

            //Assert
            Assert.False(actual);
        }
Esempio n. 2
0
        public void SaveValidTest()
        {
            //Given
            var orderRepo = new OrderRepository();
            var order     = new Order();
            //When
            var actual   = orderRepo.Save(order);
            var expected = true;


            //Then

            Assert.Equal(expected, actual);
        }
Esempio n. 3
0
        public void SaveTestValid()
        {
            //Arrange
            var orderRepository = new OrderRepository();
            var updateOrder     = new Order(10);

            updateOrder.OrderDate  = new DateTimeOffset(DateTime.Now.Year, 4, 14, 10, 00, 00, new TimeSpan(7, 0, 0));
            updateOrder.HasChanges = true;
            //Act
            var actual = orderRepository.Save(updateOrder);

            //Assert
            Assert.True(actual);
        }
Esempio n. 4
0
        public void OrderSaveTestInvalid()
        {
            //--Arrange
            var orderRepository = new OrderRepository();
            var updated         = new Order(1)
            {
                OrderDate  = null,
                HasChanges = true
            };
            //--Act
            var actual = orderRepository.Save(updated);

            //--Assert
            Assert.AreEqual(false, actual);
        }
Esempio n. 5
0
        public void OrderSaveTest()
        {
            //--Arrange
            var orderRepository = new OrderRepository();
            var updated         = new Order(1)
            {
                OrderDate  = new DateTimeOffset(DateTime.Now.Year, 4, 14, 10, 00, 00, new TimeSpan(7, 0, 0)),
                HasChanges = true
            };
            //--Act
            var actual = orderRepository.Save(updated);

            //--Assert
            Assert.AreEqual(true, actual);
        }
        public void SaveTestMissingDate()
        {
            //-- Arrange
            var orderRepository = new OrderRepository();
            var updatedOrder    = new Order(10)
            {
                OrderDate  = null,
                HasChanges = true
            };

            //-- Act
            var actual = orderRepository.Save(updatedOrder);

            //-- Assert
            Assert.AreEqual(false, actual);
        }
Esempio n. 7
0
        public void SaveOrderUpdates()
        {
            //-- Arrange
            var orderRepository = new OrderRepository();
            var updateOrder     = new Order(10)
            {
                OrderDate  = new DateTimeOffset(DateTime.Now.Year, 5, 3, 10, 00, 00, new TimeSpan(7, 0, 0)),
                HasChanges = true
            };

            //-- Act
            var actual = orderRepository.Save(updateOrder);

            //-- Assert
            Assert.AreEqual(true, actual);
        }
Esempio n. 8
0
        public void SaveTestMissingDate()
        {
            //--Arange
            var orderRepository = new OrderRepository();
            var order           = new Order(2)
            {
                OrderID    = 2,
                CustomerID = 2,
                HasChanges = true
            };
            //--Act
            var actual = orderRepository.Save(order);

            //--Assert
            Assert.AreEqual(false, actual);
        }
Esempio n. 9
0
        public void SaveTestValid()
        {
            //-- Arrange
            var orderRepository = new OrderRepository();
            var updatedOrder    = new Order(1)
            {
                OrderDate  = DateTime.Parse("Nov 25 2021"),
                HasChanges = true
            };

            //-- Act
            var actual = orderRepository.Save(updatedOrder);

            //-- Assert
            Assert.AreEqual(true, actual);
        }
Esempio n. 10
0
        public void SaveTestValid()
        {
            //--Arrange
            var orderProduct = new OrderRepository();
            var order        = new Order(10)
            {
                OrderDate = new DateTimeOffset(
                    DateTime.Now.Year, 5, 12, 9, 00, 00, new TimeSpan(8, 0, 0)),

                HasChanges = true
            };

            //--Act
            var actual = orderProduct.Save(order);

            //--Assert
            Assert.AreEqual(true, actual);
        }
Esempio n. 11
0
        public void SaveTestValid()
        {
            //--Arange
            var orderRepository = new OrderRepository();
            var updateOrder     = new Order(2)
            {
                OrderID    = 2,
                CustomerID = 2,
                OrderDate  = new DateTimeOffset(DateTime.Now.Year, 4, 14, 10, 00, 00,
                                                new TimeSpan(7, 0, 0)),
                HasChanges = true
            };

            //--Act
            var actual = orderRepository.Save(updateOrder);

            //--Assert
            Assert.AreEqual(true, actual);
        }
Esempio n. 12
0
        public void SaveTestMissingOrderDatee()
        {
            //-- Arrange
            var orderRepository = new OrderRepository();
            var updateOrder     = new Order(2)
            {
                OrderDate  = null,
                OrderItems = new List <OrderItem>
                {
                    new OrderItem
                    {
                        ProductId     = 1,
                        PurchasePrice = 12m,
                        Quantity      = 2
                    }
                },
                HasChanges = true
            };
            //--Act
            var actual = orderRepository.Save(updateOrder);

            //Assert
            Assert.AreEqual(false, actual);
        }
Esempio n. 13
0
        public void SaveTestValid()
        {
            //-- Arrange
            var orderRepository = new OrderRepository();
            var updateOrder     = new Order(2)
            {
                OrderDate  = new DateTime(2020, 10, 09),
                OrderItems = new List <OrderItem>
                {
                    new OrderItem
                    {
                        ProductId     = 1,
                        PurchasePrice = 12m,
                        Quantity      = 2
                    }
                },
                HasChanges = true
            };
            //--Act
            var actual = orderRepository.Save(updateOrder);

            //Assert
            Assert.AreEqual(true, actual);
        }