Exemple #1
0
        public async Task UpdateOrderFailure()
        {
            // Arrange
            var order = new Order();
            var orderDataAccessMock = new Mock <IOrderDataAccess>();

            orderDataAccessMock
            .Setup(dataAccess => dataAccess.UpdateOrder(order))
            .ReturnsAsync(false);

            var getOrderService = new UpdateOrderService(orderDataAccessMock.Object);

            // Act
            var action = await getOrderService.UpdateOrder(order);

            // Assert
            Assert.IsFalse(action);
            orderDataAccessMock.Verify();
        }
Exemple #2
0
        public async Task DeleteOrderSuccess()
        {
            // Arrange
            var orderIdentityMock   = new Mock <IOrderIdentity>();
            var orderDataAccessMock = new Mock <IOrderDataAccess>();

            orderDataAccessMock
            .Setup(dataAccess => dataAccess.DeleteOrder(orderIdentityMock.Object))
            .ReturnsAsync(true);

            var getOrderService = new UpdateOrderService(orderDataAccessMock.Object);

            // Act
            var action = await getOrderService.DeleteOrder(orderIdentityMock.Object);

            // Assert
            Assert.IsTrue(action);
            orderDataAccessMock.Verify();
        }
Exemple #3
0
        public async Task DeleteOrderArgumentNullFailure()
        {
            // Arrange
            var orderDataAccessMock = new Mock <IOrderDataAccess>();

            orderDataAccessMock
            .Setup(dataAccess => dataAccess.DeleteOrder(null))
            .ThrowsAsync(new ArgumentNullException());

            var getOrderService = new UpdateOrderService(orderDataAccessMock.Object);

            // Act
            var action = new Func <Task>(() => getOrderService.DeleteOrder(null));

            // Assert
            await action.Should().ThrowAsync <ArgumentNullException>("Null params");

            orderDataAccessMock.Verify();
        }
Exemple #4
0
 public async Task Delete(int id)
 {
     await UpdateOrderService.DeleteOrder(new EntityModel(id));
 }
Exemple #5
0
 public async Task Patch(OrderDTO order)
 {
     await UpdateOrderService.UpdateOrder(Mapper.Map <Order>(order));
 }