public void MarketValueLessZeroResultHighlightTrue()
        {
            var stock = new Stock {
                Type = StockType.Equity, Id = 10, Price = -1000, Quantity = 10
            };

            var target = new StockProxy(stock);

            Assert.IsTrue(target.Highlight);
        }
        public void BondTransactionCostGreatToleranceResultHighlightTrue()
        {
            var stock = new Stock {
                Type = StockType.Bond, Id = 10, Price = (decimal)(10000 / 0.02), Quantity = 11
            };

            var target = new StockProxy(stock);

            Assert.IsTrue(target.Highlight);
        }
        public void NormalObjectResultHighlightFalse()
        {
            var stock = new Stock {
                Type = StockType.Equity, Id = 10, Price = 1000, Quantity = 10
            };

            var target = new StockProxy(stock);

            Assert.IsFalse(target.Highlight);
        }
        public void TotalMarketValueSet20000ResultStockWeight0_5()
        {
            var stock = new Stock {
                Type = StockType.Equity, Id = 10, Price = 1000, Quantity = 10
            };

            var target = new StockProxy(stock);

            Assert.AreEqual(1, target.StockWeight);
            target.TotalMarketValue = 20000;
            Assert.AreEqual(0.5, target.StockWeight);
        }
        public void TotalMarketValueSetZeroResultStockWeightNotChanged()
        {
            var stock = new Stock {
                Type = StockType.Equity, Id = 10, Price = 1000, Quantity = 10
            };

            var target = new StockProxy(stock);

            Assert.AreEqual(1, target.StockWeight);
            target.TotalMarketValue = 0;
            Assert.AreEqual(1, target.StockWeight);
        }
        public void CheckEquityTransactionCostCoefResult0_005()
        {
            var stock = new Stock {
                Type = StockType.Equity, Id = 10, Price = 1000, Quantity = 10
            };

            var target = new StockProxy(stock);

            var coef = target.TransactionCost / target.TotalMarketValue;

            Assert.AreEqual((decimal)0.005, coef);
        }
        public void ConstructorStockNotNullResultStockProxyFilledFromStock()
        {
            var stock = new Stock {
                Type = StockType.Bond, Id = 10, Price = 1000, Quantity = 10
            };

            var target = new StockProxy(stock);

            Assert.AreEqual(StockType.Bond, target.Type);
            Assert.AreEqual("Bond10", target.Name);
            Assert.AreEqual(1000, target.Price);
            Assert.AreEqual(10, target.Quantity);
            Assert.AreEqual(10000, target.MarketValue);
            Assert.AreEqual(10000, target.TotalMarketValue);
            Assert.AreEqual((decimal)(10000 * 0.02), target.TransactionCost);
            Assert.AreEqual(1, target.StockWeight);
        }
 public void ConstructorNullResultException()
 {
     var target = new StockProxy(null);
 }