public void ShouldNotAddNewClientStockIfItExists() { // Arrange ClientStockService clientStockService = new ClientStockService(clientStockTableRepository); ClientStockInfo clientStockInfo = new ClientStockInfo { ClientId = 1, StockId = 1, Amount = 10 }; // Act clientStockService.AddClientStock(clientStockInfo); clientStockTableRepository.ContainsDTO(Arg.Is <ClientStock>( w => w.ClientID == 1 && w.StockID == 1 && w.Quantity == 10)).Returns(true); clientStockService.AddClientStock(clientStockInfo); }
public void ShouldAddNewClientStock() { //Arrange ClientStockService clientStockService = new ClientStockService(clientStockTableRepository); ClientStockInfo clientStockInfo = new ClientStockInfo { ClientId = 1, StockId = 1, Amount = 10 }; //Act clientStockService.AddClientStock(clientStockInfo); //Assert clientStockTableRepository.Received(1).Add(Arg.Is <ClientStock>( w => w.ClientID == 1 && w.StockID == 1 && w.Quantity == 10 )); }