Пример #1
0
        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>();
        }
Пример #2
0
 public PriceHistoryService(IPriceHistoryRepository priceHistoryRepository)
 {
     _priceHistoryRepository = priceHistoryRepository;
 }
Пример #3
0
 public PriceHistoryService(IPriceHistoryRepository priceHistoryRepository, IUnitOfWork unitOfWork)
 {
     this._priceHistoryRepository = priceHistoryRepository;
     this._unitofwork             = unitOfWork;
 }
Пример #4
0
 public PriceHistoryController(IPriceHistoryRepository priceHistoryRepository)
 {
     this.priceHistoryRepository = priceHistoryRepository;
 }