public void SerilaizeTest()
        {
            var assets = new Dictionary <string, Asset>
            {
                { "CASH", new Asset() }
            };

            var acc = new Shared.PortfolioResources.Portfolio
            {
                Assets         = assets,
                Username       = "******",
                Password       = "******",
                WriteAuthority = true,
                PortfolioID    = 1
            };

            var m = new GetPortfolioRequest
            {
                Account = acc,
            };

            var serializedMessage = MessageFactory.GetMessage(m.Encode(), false) as GetPortfolioRequest;

            Assert.IsNotNull(serializedMessage);
            Assert.AreEqual(serializedMessage.Account.Assets.Count, 1);
            Assert.AreEqual(serializedMessage.Account.Password, "yolo");
            Assert.AreEqual(serializedMessage.Account.Username, "foohooboo");
            Assert.AreEqual(serializedMessage.Account.PortfolioID, 1);
            Assert.IsTrue(serializedMessage.Account.WriteAuthority);
        }
        public void InitializeTest()
        {
            var acc = new Shared.PortfolioResources.Portfolio();

            var m = new GetPortfolioRequest
            {
                Account = acc
            };

            Assert.AreEqual(m.Account.Assets.Count, 0);
            Assert.IsNull(m.Account.Password);
        }
Exemple #3
0
 public static bool HasEqualAssets(Portfolio portfolio, Portfolio comparingPortfolio)
 {
     return(portfolio.Assets.OrderBy(kvp => kvp.Key).SequenceEqual(comparingPortfolio.Assets.OrderBy(kvp => kvp.Key)));
 }