Beispiel #1
0
        public void Update_ClientOrderNull_ThrowsException()
        {
            // Arrange
            ClientOrderHandler clientOrderHandler = new ClientOrderHandler();
            ClientOrder        clientOrder        = null;

            // Act
            // Assert
            Assert.ThrowsException <TargetException>(() => clientOrderHandler.Update(clientOrder));
        }
Beispiel #2
0
        public void Update_ClientOrderCorrectEntity_ReturnTrueAndNewEntityHasCorrectSetFields()
        {
            // Arrange
            ClientOrderProvider clientOrderProvider = new ClientOrderProvider();
            var oldClientOrder = clientOrderProvider.GetById(1);

            ClientOrderHandler clientOrderHandler = new ClientOrderHandler();
            ClientOrder        clientOrder        = new ClientOrder();

            clientOrder.Id           = 1;
            clientOrder.ClientId     = "c983fea1-a550-4ea6-b45a-db66d9defcc1";
            clientOrder.DeliveryId   = 1;
            clientOrder.CreationDate = DateTime.Now;
            clientOrder.DeliveryDate = DateTime.Now;
            clientOrder.Orders       = new List <Order>();
            // Act
            bool result         = clientOrderHandler.Update(clientOrder);
            var  newClientOrder = clientOrderProvider.GetById(1);

            // Assert
            Assert.IsTrue(result);
            Assert.AreEqual("c983fea1-a550-4ea6-b45a-db66d9defcc1", newClientOrder.ClientId);
            Assert.AreEqual(1, newClientOrder.DeliveryId);
        }