示例#1
0
 public void SaveOrder_InvalidInput()
 {
     IStockRepository stockRepository = new StubIStockRepository()
     {
         SaveOrderOrderDetail = (orderdetail) => { }
     };
     var result = new StockBusiness(stockRepository).SaveOrder(null);
 }
示例#2
0
        public void LoadStock_NoData()
        {
            IStockRepository stockRepository = new StubIStockRepository()
            {
                GetAllStock = () => new List <StockDetail>()
            };
            var result = new StockBusiness(stockRepository).LoadStock(2);

            Assert.IsTrue(result.Count == 2);
        }
示例#3
0
        public void FluctuatePrice_NullStocks()
        {
            IStockRepository stockRepository = new StubIStockRepository()
            {
                GetAllStock = () => new List <StockDetail>()
            };
            var result = new StockBusiness(stockRepository).FluctuatePrice();

            Assert.IsInstanceOfType(result, typeof(List <StockDetail>));
        }
示例#4
0
        public void GetStockDetail_NoData()
        {
            IStockRepository stockRepository = new StubIStockRepository()
            {
                GetStockDetailString = (stockname) => new StockDetail()
                {
                    StockName          = "test",
                    StockPrice         = 1,
                    PreviousStockPrice = 2.0M
                }
            };

            new StockBusiness(stockRepository).GetStockDetail("");
        }
示例#5
0
        public void GetStockDetail_Success()
        {
            IStockRepository stockRepository = new StubIStockRepository()
            {
                GetStockDetailString = (stockname) => new StockDetail()
                {
                    StockName          = "test",
                    StockPrice         = 1,
                    PreviousStockPrice = 2.0M
                }
            };

            Assert.IsNotNull(new StockBusiness(stockRepository).GetStockDetail("test"));
        }
示例#6
0
        public void LoadStock_Success()
        {
            IStockRepository stockRepository = new StubIStockRepository()
            {
                GetAllStock = () => new List <StockDetail>()
                {
                    new StockDetail()
                    {
                        StockDetailID = 1,
                        StockName     = "aaa"
                    }
                }
            };
            var result = new StockBusiness(stockRepository).LoadStock(2);

            Assert.IsTrue(result.Count == 1);
        }
示例#7
0
        public void FluctuatePrice_ValidResult()
        {
            IStockRepository stockRepository = new StubIStockRepository()
            {
                GetAllStock = () => new List <StockDetail>()
                {
                    new StockDetail()
                    {
                        PreviousStockPrice        = 1.0M,
                        StockName                 = "aaa",
                        StockDetailID             = 1,
                        StockDifference           = 2.0M,
                        StockDifferencePercentage = -0.1M,
                        StockPrice                = 10.0M
                    }
                }
            };
            var result = new StockBusiness(stockRepository).FluctuatePrice();

            Assert.IsInstanceOfType(result, typeof(List <StockDetail>));
            Assert.IsNotNull(result);
        }