public async Task Portfolio_should_have_assets_after_adding_assets() { var portfolioWithValue = new PortfolioWithValue(); await portfolioWithValue.Load(); portfolioWithValue.AddAsset(new Asset(new Symbol("MSFT"), 10)); portfolioWithValue.AddAsset(new Asset(new Symbol("AAPL"), 10)); portfolioWithValue.Portfolio.Assets.Should().BeEquivalentTo(new Asset(new Symbol("MSFT"), 10), new Asset(new Symbol("AAPL"), 10)); }
public async Task Calculate_should_set_total_value() { // ReSharper disable once ConvertToLocalFunction QuoteLoaderDelegate quoteLoaderPrice100 = symbols => Task.FromResult(symbols.Select(symbol => new Quote(symbol, 100))); var portfolioWithValue = new PortfolioWithValue(quoteLoaderPrice100); await portfolioWithValue.Load(); portfolioWithValue.AddAsset(new Asset(new Symbol("MSFT"), 10)); portfolioWithValue.AddAsset(new Asset(new Symbol("AAPL"), 10)); #pragma warning disable 4014 portfolioWithValue.Calculate(); #pragma warning restore 4014 portfolioWithValue.TotalValue.Should().Be(2000); }