示例#1
0
 private void TestInputForTotalsTest(StockService service)
 {
     service.CreateNewStock(StockType.Bond, 10, 2);
     service.CreateNewStock(StockType.Equity, 10, 2);
     service.CreateNewStock(StockType.Equity, 10, 2);
     service.CreateNewStock(StockType.Bond, 10, 2);
     service.CreateNewStock(StockType.Bond, 10, 2);
 }
示例#2
0
        public void TestNameEquityBond()
        {
            var service = new StockService();

            var stock1 = service.CreateNewStock(StockType.Equity, 1, 1);
            var stock2 = service.CreateNewStock(StockType.Bond, 1, 1);

            Assert.AreEqual("Equity1", stock1.Name);
            Assert.AreEqual("Bond1", stock2.Name);
        }
示例#3
0
        public void TestStockWeight()
        {
            var service = new StockService();

            service.CreateNewStock(StockType.Bond, 2.0M, 10);
            service.CreateNewStock(StockType.Bond, 25.0M, 2);
            service.CreateNewStock(StockType.Bond, 6.0M, 5);

            var dtos = service.ListDTO();

            Assert.AreEqual(20, dtos[0].StockWeight);
            Assert.AreEqual(50, dtos[1].StockWeight);
            Assert.AreEqual(30, dtos[2].StockWeight);
        }
示例#4
0
        public void CanCreateStock()
        {
            var service = new StockService();

            service.CreateNewStock(StockType.Bond, 1, 1);

            Assert.AreEqual(1, service.Count());
        }
示例#5
0
        public void TestNameBond()
        {
            var service = new StockService();

            var stock = service.CreateNewStock(StockType.Bond, 1, 1);

            Assert.AreEqual("Bond1", stock.Name);
        }
示例#6
0
        public void TestNameEquity()
        {
            var service = new StockService();

            var stock = service.CreateNewStock(StockType.Equity, 1, 1);

            Assert.AreEqual("Equity1", stock.Name);
        }
示例#7
0
        public void CanGetDTOAfterCreateNew()
        {
            var service = new StockService();

            service.CreateNewStock(StockType.Bond, 1, 1);
            var dto = service.GetDTO(1);

            Assert.IsNotNull(dto);
        }
示例#8
0
        public void CanListAfterInsert()
        {
            var service = new StockService();

            service.CreateNewStock(StockType.Bond, 1, 1);

            var list = service.ListDTO();

            Assert.AreEqual(1, list.Count);
        }
示例#9
0
        public void TestIfShouldHighlight(StockType type, double price, int quantity, bool highlight)
        {
            var service = new StockService();

            service.CreateNewStock(type, (decimal)price, quantity);

            var dto = service.GetDTO(1);

            Assert.AreEqual(highlight, dto.Highlight);
        }
示例#10
0
        public void TestTransactionCost(StockType type, double price, int quantity, double expectedTransactionCost)
        {
            var service = new StockService();

            service.CreateNewStock(type, (decimal)price, quantity);

            var dto = service.GetDTO(1);

            Assert.AreEqual((decimal)expectedTransactionCost, dto.TransactionCost);
        }