public TransactionService(IClientTableRepository clientTableRepository, IStockTableRepository stockTableRepository, IStockOfClientsTableRepository stockClientTableRepository, ITransactionHistoryTableRepository transactionHistoryTableRepository, EditCleintStockService editCleintStockService) { this.clientTableRepository = clientTableRepository; this.stockTableRepository = stockTableRepository; this.stockClientTableRepository = stockClientTableRepository; this.transactionHistoryTableRepository = transactionHistoryTableRepository; this.editCleintStockService = editCleintStockService; }
public void Initialize() { this.clientTableRepository = Substitute.For <IClientTableRepository>(); this.stockTableRepository = Substitute.For <IStockTableRepository>(); this.stockOfClientsTableRepository = Substitute.For <IStockOfClientsTableRepository>(); this.transactionHistoryTableRepository = Substitute.For <ITransactionHistoryTableRepository>(); this.editCleintStockService = new EditCleintStockService(this.stockOfClientsTableRepository); this.clientTableRepository.Get(5).Returns(new ClientEntity() { ID = 5, Name = "Serj", Surname = "Tankian", PhoneNumber = "+7228133705", AccountBalance = 100, }); this.clientTableRepository.Get(32).Returns(new ClientEntity() { ID = 32, Name = "Chester", Surname = "Bennington", PhoneNumber = "+7228133705", AccountBalance = 50 }); this.stockTableRepository.Get(1).Returns(new StockEntity() { ID = 1, Name = "Yandex", Type = "P", Cost = 10 }); this.stockOfClientsTableRepository.Get(2).Returns(new StockOfClientsEntity() { ID = 2, ClientID = 32, StockID = 1, Amount = 5 }); this.stockTableRepository.GetCost(Arg.Is <int>(1)).Returns(10); this.stockOfClientsTableRepository.GetAmount( Arg.Is <int>(5), Arg.Is <int>(1)).Returns(0); this.stockOfClientsTableRepository.GetAmount( Arg.Is <int>(32), Arg.Is <int>(1)).Returns(10); this.clientTableRepository.GetBalance(Arg.Is <int>(5)).Returns(100); this.clientTableRepository.GetBalance(Arg.Is <int>(32)).Returns(50); this.stockTableRepository.GetType(Arg.Is <int>(1)).Returns("P"); }
public EditCleintStockService(IStockOfClientsTableRepository stockOfClientsTableRepository) { this.stockOfClientsTableRepository = stockOfClientsTableRepository; }