public TradeSimulator(IValidator validator, ILogger logger, ClientService clientService, ShareService shareService, TradingOperationService tradingOperationService) { this.clientService = clientService; this.shareService = shareService; this.validator = validator; this.logger = logger; this.tradingOperationService = tradingOperationService; logger.InitLogger(); uniformRandomiser = new Random(); }
public void ShouldNotBuyAndSellSharesMoreThanHave() { //Arrange TradingOperationService operationService = new TradingOperationService( clientService, shareService, clientsSharesService); int firstClientID = 1; int secondClientID = 2; ClientsSharesEntity clientsShares = new ClientsSharesEntity() { ClientID = 1, ShareID = 1, Amount = 10 }; int numberOfSoldShares = 100; //Act operationService.SellAndBuyShares(firstClientID, secondClientID, clientsShares, numberOfSoldShares); //Assert clientsSharesService.DidNotReceive().ChangeClientsSharesAmount(Arg.Any <ClientsSharesInfo>()); clientService.DidNotReceive().ChangeMoney(Arg.Any <int>(), Arg.Any <decimal>()); }
public DealController(TradingOperationService tradingOperationService, ClientsSharesService clientsSharesService) { this.tradingOperationService = tradingOperationService; this.clientsSharesService = clientsSharesService; }