public void Execute_ShouldThrowKeyNotFoundExeption() { //Arrange var RequestModel = new ModifyBatchStockRequest(2, 100, "Reason"); //Act and Assert Assert.ThrowsAsync <KeyNotFoundException>(() => modifyStockCommand.ExecuteAsync(RequestModel)); mockUOW.Verify(m => m.CompleteAsync(), Times.Never); }
public async Task Execute_ShouldModifyBatchStock(int newUnitAmount, string reason) { //Arrange var RequestModel = new ModifyBatchStockRequest(1, newUnitAmount, reason); //Act var batch = await modifyStockCommand.ExecuteAsync(RequestModel); //Assert mockUOW.Verify(m => m.CompleteAsync(), Times.Once); Assert.Equal(newUnitAmount, batch.RemainingUnits); Assert.Equal(1, batch.History.Count); Assert.NotNull(batch); }