public void Initialize() { _priceHistoryRepository = A.Fake <IPriceHistoryRepository>(); _priceHistoryService = new PriceHistoryService(_priceHistoryRepository); _ValidStartDate = DateTime.Now.AddDays(-1); _ValidEndDate = DateTime.Now.AddDays(-1); _InvalidStartDate = DateTime.Now.AddDays(1); _InvalidEndDate = DateTime.Now.AddDays(1); A.CallTo(() => _priceHistoryRepository.GetPriceHistory(ValidSymbol, _ValidStartDate, _ValidEndDate)).Returns(new List <TradingDay>() { new TradingDay() { OpenPrice = 5.00m, HighPrice = 5.00m, LowPrice = 1.00m, ClosePrice = 5.00m, Date = DateTime.Now } }); A.CallTo(() => _priceHistoryRepository.GetPriceHistory(InvalidSymbol, _ValidStartDate, _ValidEndDate)).Throws <StockNotFoundException>(); A.CallTo(() => _priceHistoryRepository.GetPriceHistory(ValidSymbol, _InvalidStartDate, _ValidEndDate)).Throws <InvalidDateException>(); A.CallTo(() => _priceHistoryRepository.GetPriceHistory(ValidSymbol, _ValidStartDate, _InvalidEndDate)).Throws <InvalidDateException>(); }
public PriceHistoryService(IPriceHistoryRepository priceHistoryRepository) { _priceHistoryRepository = priceHistoryRepository; }
public PriceHistoryService(IPriceHistoryRepository priceHistoryRepository, IUnitOfWork unitOfWork) { this._priceHistoryRepository = priceHistoryRepository; this._unitofwork = unitOfWork; }
public PriceHistoryController(IPriceHistoryRepository priceHistoryRepository) { this.priceHistoryRepository = priceHistoryRepository; }