コード例 #1
0
        public async Task Loading_twice_should_return_different_portfolios()
        {
            IPortfolioStore portfolioStore = CreatePortfolioStore();

            Portfolio loadedPortfolio1 = await portfolioStore.Load();

            Portfolio loadedPortfolio2 = await portfolioStore.Load();

            loadedPortfolio1.Should().NotBeSameAs(loadedPortfolio2);

            await portfolioStore.Save(null);
        }
コード例 #2
0
        public async Task Loading_without_saving_should_return_portfolios_with_the_same_assets()
        {
            IPortfolioStore portfolioStore = CreatePortfolioStore();
            var             savedPortfolio = new Portfolio();

            savedPortfolio.AddAsset(new Asset(new Symbol("MSFT"), 100));
            await portfolioStore.Save(savedPortfolio);

            Portfolio loadedPortfolio1 = await portfolioStore.Load();

            Portfolio loadedPortfolio2 = await portfolioStore.Load();

            loadedPortfolio1.Assets.Should().BeEquivalentTo(loadedPortfolio2.Assets);

            await portfolioStore.Save(null);
        }
コード例 #3
0
        public void Loading_error_should_throw_PortfolioStoreLoadException()
        {
            IPortfolioStore portfolioStore = CreatePortfolioStoreWithLoadError();

            Func <Task <Portfolio> > action = async() => await portfolioStore.Load();

            action.Should().Throw <PortfolioStoreLoadException>();
        }
コード例 #4
0
 public async Task Load()
 {
     Portfolio = await _portfolioStore.Load();
 }