public async Task TestMethod_GetGatePassByPlateNumber_Exception()
        {
            GatePassRepositoryTest.FLAG_GET_ASYNC = -1;
            var response = await _queueService.GetGatePassByPlateNumber("ABC");

            GatePassRepositoryTest.ResetDummyFlags();

            Assert.AreEqual(response.errorCode, ResponseCode.ERR_NO_OBJECT_FOUND);
        }
        public async Task TestMethod_GetGatePassByRFID_NotFound()
        {
            GatePassRepositoryTest.FLAG_GET_ASYNC = 0;
            var response = await _queueService.GetGatePassByRFID("ABC");

            GatePassRepositoryTest.ResetDummyFlags();

            Assert.AreEqual(response.errorCode, ResponseCode.ERR_NO_OBJECT_FOUND);
        }
        public async Task TestMethod_GetAllGatePass_Ok()
        {
            GatePassRepositoryTest.FLAG_GET_ASYNC = 1;
            var response = await _queueService.GetAllGatePass();

            GatePassRepositoryTest.ResetDummyFlags();

            var gates = response.responseDatas;

            Assert.IsTrue(gates.Count() > 0);
        }
        public async Task TestMethod_CreateRegisteredQueueItem_NoGatePass()
        {
            GatePassRepositoryTest.FLAG_GET_ASYNC = 0;

            var response = await _queueService.CreateRegisteredQueueItem(
                1, "avatar.png", "ABC", "ABC");

            GatePassRepositoryTest.ResetDummyFlags();

            Assert.IsFalse(response.booleanResponse);
        }
        public async Task TestMethod_GetGatePassByPlateNumber_Found()
        {
            GatePassRepositoryTest.FLAG_GET_ASYNC = 1;
            var response = await _queueService.GetGatePassByPlateNumber("ABC");

            GatePassRepositoryTest.ResetDummyFlags();

            var gate = response.responseData;

            Assert.IsNotNull(gate);
        }
        public async Task TestMethod_UpdateGatePassWithRFIDCode_Ok()
        {
            GatePassRepositoryTest.FLAG_GET_ASYNC   = 1;
            GatePassRepositoryTest.FLAG_GET_ASYNC_2 = 1;
            var sampleGateView = new GatePassViewModel();

            sampleGateView.driver = new DriverViewModel();

            var updateResponse = await _queueService.UpdateGatePassWithRFIDCode(sampleGateView);

            GatePassRepositoryTest.ResetDummyFlags();

            var gate = updateResponse.responseData;

            Assert.IsNotNull(gate);
        }
        public async Task TestMethod_UpdateGatePass_SaveException()
        {
            GatePassRepositoryTest.FLAG_GET_ASYNC   = 1;
            GatePassRepositoryTest.FLAG_GET_ASYNC_2 = 1;
            UnitOfWorkTest.FLAG_SAVE = -1;
            var sampleGateView = new GatePassViewModel();

            sampleGateView.driver = new DriverViewModel();

            var updateResponse = await _queueService.UpdateGatePass(sampleGateView);

            GatePassRepositoryTest.ResetDummyFlags();
            UnitOfWorkTest.ResetDummyFlags();

            Assert.AreEqual(updateResponse.errorCode, ResponseCode.ERR_SEC_UNKNOW);
        }
        public async Task TestMethod_UpdateGatePassWithRFIDCode_SaveFail()
        {
            GatePassRepositoryTest.FLAG_GET_ASYNC   = 1;
            GatePassRepositoryTest.FLAG_GET_ASYNC_2 = 1;
            UnitOfWorkTest.FLAG_SAVE = 0;
            var sampleGateView = new GatePassViewModel();

            sampleGateView.driver = new DriverViewModel();

            var updateResponse = await _queueService.UpdateGatePassWithRFIDCode(sampleGateView);

            GatePassRepositoryTest.ResetDummyFlags();
            UnitOfWorkTest.ResetDummyFlags();

            var gate = updateResponse.responseData;

            Assert.AreEqual(updateResponse.errorCode, ResponseCode.ERR_DB_FAIL_TO_SAVE);
        }
        public async Task TestMethod_CreateRegisteredQueueItem_SaveException()
        {
            GatePassRepositoryTest.FLAG_GET_ASYNC  = 1;
            GatePassRepositoryTest.FLAG_ORDER_TYPE = 1;
            RFIDCardRepositoryTest.FLAG_GET_ASYNC  = 1;
            LaneRepositoryTest.FLAG_GET_ASYNC      = 1;
            TruckRepositoryTest.FLAG_GET_ASYNC     = 1;
            UnitOfWorkTest.FLAG_SAVE = -1;

            var response = await _queueService.CreateRegisteredQueueItem(
                1, "avatar.png", "ABC", "ABC");

            GatePassRepositoryTest.ResetDummyFlags();
            RFIDCardRepositoryTest.ResetDummyFlags();
            LaneRepositoryTest.ResetDummyFlags();
            TruckRepositoryTest.ResetDummyFlags();

            Assert.IsFalse(response.booleanResponse);
        }
예제 #10
0
        public QueueServiceTest()
        {
            AutoMapper.Mapper.Reset();
            AutoMapperConfig.Configure();

            _unitOfWork                  = new UnitOfWorkTest();
            _gatePassRepository          = new GatePassRepositoryTest();
            _stateRepository             = new StateRepositoryTest();
            _laneRepository              = new LaneRepositoryTest();
            _truckRepository             = new TruckRepositoryTest();
            _queueListRepository         = new QueueListRepositoryTest();
            _RFIDCardRepository          = new RFIDCardRepositoryTest();
            _employeepository            = new EmployeeRepositoryTest();
            _saleOrderRepository         = new SaleOrderRepositoryTest();
            _deliveryOrderRepository     = new DeliveryOrderRepositoryTest();
            _orderRepository             = new OrderRepositoryTest();
            _carrierVendorRepository     = new CarrierVendorRepositoryTest();
            _customerRepository          = new CustomerRepositoryTest();
            _deliveryOrderTypeRepository = new DeliveryOrderTypeRepositoryTest();
            _customerWarehouseRepository = new CustomerWarehouseRepositoryTest();
            _orderMaterialRepository     = new OrderMaterialRepositoryTest();
            _materialRepository          = new MaterialRepositoryTest();
            _driverRepository            = new DriverRepositoryTest();
            //_unitTypeRepository = new UnitTypeRepositoryTest();
            _loadingBayRepository = new LoadingBayRepositoryTest();
            //_commonService = new CommonServiceTest();
            //_purchaseOrderRepository = new PurchaseOrderRepositoryTest();
            //_purchaseOrderTypeRepository = new PurchaseOrderTypeRepositoryTest();
            _plantRepository = new PlantRepositoryTest();
            _queueService    = new QueueService(
                _unitOfWork, _gatePassRepository, _stateRepository, _laneRepository,
                _truckRepository, _queueListRepository, _RFIDCardRepository,
                _employeepository, _saleOrderRepository, _deliveryOrderRepository,
                _orderRepository, _carrierVendorRepository, _customerRepository,
                _deliveryOrderTypeRepository, _customerWarehouseRepository,
                _orderMaterialRepository, _materialRepository, _driverRepository,
                _unitTypeRepository, _loadingBayRepository, _commonService,
                _purchaseOrderRepository, _purchaseOrderTypeRepository,
                _plantRepository
                );
        }