Ejemplo n.º 1
0
        public void CannotRebalanceWithZeroOriginalPositionValue()
        {
            Portfolio orig = new Portfolio{
                Positions = new ObservableCollection<Position>{
                    new Position {
                        SecurityIdentifier = "gumballs",
                        Amount = 0.0
                    }
                }
            };
            Portfolio recommended = new Portfolio
            {
                Positions = new ObservableCollection<Position>{
                    new Position {
                        SecurityIdentifier = "cherries",
                        Amount = 0.0
                    }
                }
            };
            Customer target = new Customer
            {
                OriginalPortfolio = orig,
                RecommendedPortfolio = recommended
            };

            Assert.IsFalse(target.CanRebalance(), "checking CanRebalance");
        }
Ejemplo n.º 2
0
        public void CanRebalanceWithPositiveOriginalPositionValue()
        {
            double newValue = 123456.78;
            Portfolio orig = new Portfolio
            {
                Positions = new ObservableCollection<Position>{
                    new Position {
                        SecurityIdentifier = "gumballs",
                        Amount = 0.0
                    }
                }
            };
            Portfolio recommended = new Portfolio
            {
                Positions = new ObservableCollection<Position>{
                    new Position {
                        SecurityIdentifier = "cherries",
                        Amount = 0.0
                    }
                }
            };
            Customer target = new Customer
            {
                OriginalPortfolio = orig,
                RecommendedPortfolio = recommended
            };

            orig.Positions[0].Amount = newValue;

            Assert.IsTrue(target.CanRebalance(), "checking CanRebalance");
        }
Ejemplo n.º 3
0
        public void FullName()
        {
            string firstName = "George";
            string lastName = "Jetson";
            string expected = firstName + " " + lastName;

            Customer target = new Customer
            {
                FirstName = firstName,
                LastName = lastName
            };
            Assert.AreEqual(expected, target.FullName, "checking FullName");
        }
Ejemplo n.º 4
0
        public void RebalancingWithOneRecommendedPosition()
        {
            double newValue = 123456.78;
            Portfolio orig = new Portfolio
            {
                Positions = new ObservableCollection<Position>{
                    new Position {
                        SecurityIdentifier = "gumballs",
                        Amount = 0.0
                    }
                }
            };
            Portfolio recommended = new Portfolio
            {
                Positions = new ObservableCollection<Position>{
                    new Position {
                        SecurityIdentifier = "cherries",
                        Amount = 0.0
                    }
                }
            };
            Customer target = new Customer
            {
                OriginalPortfolio = orig,
                RecommendedPortfolio = recommended
            };

            orig.Positions[0].Amount = newValue;
            Assert.IsTrue(target.CanRebalance(), "checking CanRebalance");

            target.DoRebalance();

            Assert.AreEqual(newValue, target.RecommendedPortfolio.TotalValue, "checking recommended total value");
            Assert.AreEqual(newValue, target.RecommendedPortfolio.Positions[0].Amount, "checking recommended position 0 amount");
        }