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);
        }
Ejemplo n.º 2
0
        public void ShouldNotRegisterNewClientIfItExists()
        {
            // Arrange

            ClientService clientService = new ClientService(clientTableRepository);
            ClientInfo    clientInfo    = new ClientInfo
            {
                LastName  = "Petrov",
                FirstName = "Petr",
                Phone     = "1235698",
                Balance   = 1000
            };

            // Act
            clientService.AddClientToDB(clientInfo);

            clientTableRepository.ContainsDTO(Arg.Is <Client>(
                                                  w => w.LastName == clientInfo.LastName &&
                                                  w.FirstName == clientInfo.FirstName &&
                                                  w.Phone == clientInfo.Phone)).Returns(true);

            clientService.AddClientToDB(clientInfo);
        }