コード例 #1
0
        public void GetHoldings_ShouldReturnHoldings()
        {
            var   AccountId          = 2;
            float LatestCostPerStock = 10.65F;
            float Change             = -0.33F;
            float ChangePercentage   = -0.02957F;
            var   LastUpdated        = DateTime.Now;

            var holdings = new List <Holdings>
            {
                new Holdings
                {
                    Id                 = 2,
                    AccountId          = AccountId,
                    CompanyName        = "General Electric Co.",
                    Symbol             = "GE",
                    StockCount         = 5,
                    LatestCostPerStock = LatestCostPerStock,
                    Change             = Change,
                    ChangePercentage   = ChangePercentage,
                    LastUpdated        = LastUpdated,
                }
            };

            _session.Query <Holdings>().Returns(holdings.AsQueryable());

            var resultHoldings = _sut.GetHoldings(AccountId);

            Assert.That(resultHoldings.Count, Is.EqualTo(1));
        }
 public IQueryable <HoldingsModel> GetHoldings(int AccountId)
 {
     return(_holdingsService.GetHoldings(AccountId)
            .Select(holdings => new HoldingsModel
     {
         Id = holdings.Id,
         AccountId = holdings.AccountId,
         CompanyName = holdings.CompanyName,
         Symbol = holdings.Symbol,
         StockCount = holdings.StockCount,
         LatestCostPerStock = holdings.LatestCostPerStock,
         Change = holdings.Change,
         ChangePercentage = holdings.ChangePercentage,
         LastUpdated = holdings.LastUpdated
     }));
 }