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(); }
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(); }
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(); }
public async Task Delete(int id) { await UpdateOrderService.DeleteOrder(new EntityModel(id)); }
public async Task Patch(OrderDTO order) { await UpdateOrderService.UpdateOrder(Mapper.Map <Order>(order)); }