public void ToString_WithAnInvalidStockEntry_ReturnsFormattedString()
        {
            string expected = $"StockEntry: StockEntryId = 0, StockItemId = 0, EntryDate = {DateTime.MinValue.ToString(ArtsApi.DATE_FORMAT)}, "
                              + $"AveragePrice = 0, HighestPrice = 0, LowestPrice = 0, DataPoints = 0, AvergaeChangeFromPreviousDay = null";

            _stockEntry = JsonConvert.DeserializeObject <StockEntry>(StockEntryTestData.INVALID_STOCK_ENTRY_JSON);
            Assert.AreEqual(expected, _stockEntry.ToString());
        }
        public void ToString_WithoutAverageChange_ReturnsFormattedString()
        {
            string expected = $"StockEntry: StockEntryId = {StockEntryTestData.STOCK_ENTRY_ID}, StockItemId = {StockItemTestData.STOCK_ITEM_ID}, "
                              + $"EntryDate = {StockEntryTestData.ENTRY_DATE}, AveragePrice = {StockEntryTestData.AVERAGE_PRICE}, HighestPrice = "
                              + $"{StockEntryTestData.HIGHEST_PRICE}, LowestPrice = {StockEntryTestData.LOWEST_PRICE}, DataPoints = {StockEntryTestData.DATA_POINTS}, "
                              + $"AvergaeChangeFromPreviousDay = null";

            _stockEntry = JsonConvert.DeserializeObject <StockEntry>(StockEntryTestData.VALID_STOCK_ENTRY_WITHOUT_AVERAGE_CHANGE_JSON);
            Assert.AreEqual(expected, _stockEntry.ToString());
        }
Exemple #3
0
        public void ToStringTest()
        {
            string expected = "7,ABCD,ABC,1,01/01/2000,2,3,4,5,6";

            StockEntry stock = new StockEntry();

            stock.ID                        = 7;
            stock.Exchange                  = "ABCD";
            stock.Symbol                    = "ABC";
            stock.Volume                    = 1;
            stock.Date                      = DateTime.Parse("01/01/2000");
            stock.PriceHigh.Amount          = 2;
            stock.PriceLow.Amount           = 3;
            stock.PriceOpen.Amount          = 4;
            stock.PriceClose.Amount         = 5;
            stock.PriceCloseAdjusted.Amount = 6;

            Assert.AreEqual(expected, stock.ToString());
        }