示例#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();
        }
示例#2
0
        public async Task UpdateOrderArgumentNullFailure()
        {
            // Arrange
            var discountService     = new DiscountService();
            var orderDataAccessMock = new Mock <IOrderDataAccess>();

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

            var getOrderService = new UpdateOrderService(orderDataAccessMock.Object);

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

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

            orderDataAccessMock.Verify();
        }
示例#3
0
 public async Task Patch(OrderDTO order)
 {
     await UpdateOrderService.UpdateOrder(Mapper.Map <Order>(order));
 }