private static void Test1() { var portfolio = new AssetPortfolio(); portfolio.Add(new Stock("ABC", "USD", 200, 4)); portfolio.Add(new Stock("DDW", "USD", 100, 10)); Assert(AreEqual(portfolio.Value("USD"), 1800), " Test1 Failed, Expected Value:" + "\t" + 1800 + ",\t" + "Actual Value: \t" + portfolio.Value("USD") + "\n"); }
private static void Test1() { var portfolio = new AssetPortfolio(new ExchangeRateService()); portfolio.Add(new Stock("ABC", 200, 4, Currency.USD)); portfolio.Add(new Stock("DDW", 100, 10, Currency.USD)); Assert(AreEqual(portfolio.Value(), 1800), " Test1 Failed, Expected Value:" + "\t" + 1800 + ",\t" + "Actual Value: \t" + portfolio.Value() + "\n"); }
public AssetPortfolio Consolidate() { AssetPortfolio ap = new AssetPortfolio(ExchangeRates, $"consolidated {Name}"); foreach (KeyValuePair <Asset, List <Asset> > asset in _symbols) { Asset newAsset = asset.Key.Consolidate(asset.Value); ap.Add(newAsset); } return(ap); }