예제 #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);
        }