public void CreateFromRawData_UnitPrice(string unitPrice, decimal expected, string expectedCurrency)
        {
            var asset = PortfolioAsset.CreateFromRawData("iShares 20+ Year Treasury Bond ETF", "10", unitPrice, "6617");

            asset.UnitPrice.ShouldBe(expected);
            asset.Currency.ShouldBe(expectedCurrency);
        }
Beispiel #2
0
        static List <PortfolioAsset> Convert(dynamic py_assets)
        {
            var assets = new List <PortfolioAsset>();

            for (int i = 0; i < py_assets.Length(); i++)
            {
                assets.Add(PortfolioAsset.CreateFromRawData((string)py_assets[i].name, (string)py_assets[i].units, (string)py_assets[i].unitPrice, (string)py_assets[i].valueSEK));
            }
            return(assets);
        }
        public void CreateFromRawData_BaseCase()
        {
            const string expectedName = "iShares 20+ Year Treasury Bond ETF";
            var          asset        = PortfolioAsset.CreateFromRawData(expectedName, "2", "600 USD", "6617");

            asset.Name.ShouldBe(expectedName);
            asset.Units.ShouldBe(2);
            asset.UnitPrice.ShouldBe(600);
            asset.Currency.ShouldBe("USD");
            asset.ValueDomesticCurrency.ShouldBe(6617);
        }
        public void CreateFromRawData_ValueDomestic(string value, decimal expected)
        {
            var asset = PortfolioAsset.CreateFromRawData("iShares 20+ Year Treasury Bond ETF", "10", "600 USD", value);

            asset.ValueDomesticCurrency.ShouldBe(expected);
        }
        public void CreateFromRawData_Units(string units, decimal expected)
        {
            var asset = PortfolioAsset.CreateFromRawData("iShares 20+ Year Treasury Bond ETF", units, "600 USD", "6617");

            asset.Units.ShouldBe(expected);
        }