Example #1
0
        public void GetStockEntryByIDTest()
        {
            //-- Arrange
            SQLStockRepository repository = new SQLStockRepository();
            StockEntry         actual     = new StockEntry();
            StockEntry         expected   = new StockEntry()
            {
                ID       = uint.Parse(500.ToString()),
                Exchange = "NYSE",
                Symbol   = "AEA",
                Date     = DateTime.Parse("2008-02-14"),
                Volume   = uint.Parse(892800.ToString())
            };

            expected.PriceOpen.Amount          = 8.00m;
            expected.PriceClose.Amount         = 7.75m;
            expected.PriceHigh.Amount          = 8.06m;
            expected.PriceLow.Amount           = 7.51m;
            expected.PriceCloseAdjusted.Amount = 6.33m;

            //-- Act
            actual = repository.GetStockEntry(500);

            //-- Assert
            Assert.AreEqual(expected.ID, actual.ID);
            Assert.AreEqual(expected.Exchange, actual.Exchange);
            Assert.AreEqual(expected.Symbol, actual.Symbol);
            Assert.AreEqual(expected.Date, actual.Date);
            Assert.AreEqual(expected.PriceOpen.Amount, actual.PriceOpen.Amount);
            Assert.AreEqual(expected.PriceClose.Amount, actual.PriceClose.Amount);
            Assert.AreEqual(expected.PriceCloseAdjusted.Amount, actual.PriceCloseAdjusted.Amount);
            Assert.AreEqual(expected.PriceHigh.Amount, actual.PriceHigh.Amount);
            Assert.AreEqual(expected.PriceLow.Amount, actual.PriceLow.Amount);
            Assert.AreEqual(expected.Volume, actual.Volume);
        }
Example #2
0
        /// <summary>Gets a stock entry</summary>
        public StockEntry GetStockEntry(uint id)
        {
            StockEntry         serverResponse = new StockEntry();
            SQLStockRepository stockRepo      = new SQLStockRepository();

            serverResponse = stockRepo.GetStockEntry(id);

            return(serverResponse);
        }