Beispiel #1
0
        public void ForGetStockReturns_YTD_ReturnNotFoundMessage_ForInvalidStock()
        {
            // Arrange
            const string stockSymbol      = "Z1X";
            const string expectedMessage  = "Not Found";
            var          stockReturnsData = new StockReturnsData();

            // Act
            var(_, message) = stockReturnsData.GetStockReturnsBySymbolOverDateRangeAsync(stockSymbol, null, null).Result;

            // Assert
            Assert.Equal(expectedMessage, message);
        }
Beispiel #2
0
        public void ForGetStockReturns_YTD_ReturnHistoricalPriceReturnRecords_ForValidStock()
        {
            // Arrange
            const string stockSymbol      = "MSFT";
            var          stockReturnsData = new StockReturnsData();

            // Act
            var(historicalPriceReturns, message) = stockReturnsData.GetStockReturnsBySymbolOverDateRangeAsync(stockSymbol, null, null).Result;

            // Assert
            //TODO: Modify test to account for only business days as this will fail on years that begin on holiday or weekend
            Assert.True(historicalPriceReturns.Count > 0);
            Assert.True(string.IsNullOrEmpty(message));
        }
Beispiel #3
0
        public void ForGetStockReturns_OverDateRangeOfOneDay_ReturnHistoricalPriceReturnRecordsOfOneRecord_ForValidStock()
        {
            // Arrange
            const string stockSymbol      = "AAPL";
            var          startDate        = Convert.ToDateTime("12/10/2020");
            var          endDate          = Convert.ToDateTime("12/10/2020");
            var          stockReturnsData = new StockReturnsData();

            // Act
            var(historicalPriceReturns, message) = stockReturnsData.GetStockReturnsBySymbolOverDateRangeAsync(stockSymbol, startDate, endDate).Result;

            // Assert
            Assert.True(historicalPriceReturns.Count == 1);
            Assert.True(string.IsNullOrEmpty(message));
        }
Beispiel #4
0
        public void ForGetStockReturns_OverDateRange_ReturnNotFoundMessage_ForInvalidStock()
        {
            // Arrange
            const string stockSymbol      = "Z1X";
            const string expectedMessage  = "Not Found";
            var          startDate        = Convert.ToDateTime("12/1/2020");
            var          endDate          = Convert.ToDateTime("12/31/2020");
            var          stockReturnsData = new StockReturnsData();

            // Act
            var(_, message) = stockReturnsData.GetStockReturnsBySymbolOverDateRangeAsync(stockSymbol, startDate, endDate).Result;

            // Assert
            Assert.Equal(expectedMessage, message);
        }