Ejemplo n.º 1
0
        public void TestGetCurrencyList()
        {
            ApiController controller = new ApiController();
            ConsolidatorService cs = new ConsolidatorService();
            cs.CurrencyManager = GetMockedCurrencyManager("NZD", 1.33);
            controller.service = cs;

            JsonResult result = controller.GetCurrencyList() as JsonResult;
            Assert.IsNotNull(result);
        }
Ejemplo n.º 2
0
        public void TestGetAllListOrderBy()
        {
            IConsolidatorService service = new ConsolidatorService();

            var list     = service.GetProductList(null, ListOrder.Name, false);
            var listDesc = service.GetProductList(null, ListOrder.Name, true);

            Assert.AreSame(list[0], list[list.Count]);

            list     = service.GetProductList(null, ListOrder.Price, false);
            listDesc = service.GetProductList(null, ListOrder.Price, true);
            Assert.AreSame(list[0], list[list.Count]);
        }
Ejemplo n.º 3
0
        public void TestGetProductList()
        {
            // string orderby, int desc, int pageSize, int pageNumber
            // Arrange
            ApiController controller = new ApiController();
            ConsolidatorService cs = new ConsolidatorService();
            cs.CurrencyManager = GetMockedCurrencyManager("NZD", 1.33);
            controller.service = cs;

            JsonResult result = controller.GetProductList("", 1, false) as JsonResult;
            Assert.IsNotNull(result);

            result = controller.GetProductList("", 1, true) as JsonResult;
            Assert.IsNotNull(result);
        }
Ejemplo n.º 4
0
        public void TestDefaultCurrency()
        {
            var cs = new ConsolidatorService();

            cs.CurrencyManager = GetMockedCurrencyManager("NZD", 1.33);
            cs.CurrencyManager.GetAllNames();
            cs.CurrencyManager.Exchange("NZD", 33);
            IConsolidatorService service = cs;

            Assert.AreEqual(service.GetCurrencyNames()[0], "NZD");

            var list = service.GetProductList("NZD", ListOrder.Default);

            Assert.IsInstanceOfType(list, typeof(List <Product>));
        }