Exemple #1
0
        public void CheapifiedPortfolioHasOneTradeAtLeastPerTradeType()
        {
            var portfolioName = "EMRATES";
            var cobDate       = DateTime.Parse("23 Jul 2017");

            var portfolio = _portfolioProvider.GetPortfolio(portfolioName, cobDate);
            IPortfolioMinifier cheapifier = new Cheapifier();

            var cheapifiedPortfolio = cheapifier.Minify(portfolio, _portfolioCostProvider.GetPortfolioCosts(portfolioName, cobDate));

            var tradeTypeUniverse = portfolio.Trades.Select(t => t.TradeType).Distinct();
            var cheapifiedPortfolioTradeTypeUniverse = cheapifiedPortfolio.Trades.Select(t => t.TradeType).Distinct();

            tradeTypeUniverse.Intersect(cheapifiedPortfolioTradeTypeUniverse).Count().Should().Be(tradeTypeUniverse.Count());
        }
        public async Task <ActionResult <Portfolio> > GetPortfolio(int id)
        {
            var portfolio = await _portfolioProvider.GetPortfolio(id);

            if (portfolio == null)
            {
                return(NotFound());
            }

            return(portfolio);
        }
 public override Portfolio CreatePortfolio(string name)
 {
     return(_portfolioProvider.GetPortfolio(name) ?? base.CreatePortfolio(name));
 }
Exemple #4
0
        public void NullShouldBeReturnedForNonExistentPortfolio()
        {
            var portfolio = _portfolioProvider.GetPortfolio("NONEXISTENT", DateTime.Parse("23 Jul 2017"));

            portfolio.Should().BeNull("because the portfolio is non existent");
        }