public async Task TestMethod_ImportDO_NoDeliOrderType()
        {
            UnitOfWorkTest.FLAG_SAVE = 1;
            SaleOrderRepositoryTest.FLAG_GET_ASYNC         = 1;
            DeliveryOrderRepositoryTest.FLAG_GET_ASYNC     = 0;
            OrderRepositoryTest.FLAG_GET_ASYNC             = 0;
            CarrierVendorRepositoryTest.FLAG_GET_ASYNC     = 1;
            CustomerRepositoryTest.FLAG_GET_ASYNC          = 1;
            DeliveryOrderTypeRepositoryTest.FLAG_GET_ASYNC = 0;
            //OrderRepositoryTest.FLAG_GET_ASYNC_2 = 1;
            //OrderMaterialRepositoryTest.FLAG_GET_ASYNC = 1;
            //MaterialRepositoryTest.FLAG_GET_ASYNC = 1;
            //MaterialRepositoryTest.FLAG_ADD = 0;

            var DoList   = GetSampleDoList();
            var response = await _queueService.ImportDO(DoList);

            UnitOfWorkTest.ResetDummyFlags();
            SaleOrderRepositoryTest.ResetDummyFlags();
            DeliveryOrderRepositoryTest.ResetDummyFlags();
            OrderRepositoryTest.ResetDummyFlags();
            CarrierVendorRepositoryTest.ResetDummyFlags();
            CustomerRepositoryTest.ResetDummyFlags();
            DeliveryOrderTypeRepositoryTest.ResetDummyFlags();

            Assert.AreNotEqual(0, response.errorCode);
        }
        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_ReOrderQueue_CleanQueueSaveException()
        {
            LaneRepositoryTest.FLAG_GET_ASYNC      = 1;
            TruckRepositoryTest.FLAG_GET_ASYNC     = 1;
            QueueListRepositoryTest.FLAG_GET_ASYNC = 1;
            QueueListRepositoryTest.FLAG_UPDATE    = 1;
            UnitOfWorkTest.FLAG_SAVE = -1;

            var response = await _queueService.ReOrderQueue();

            LaneRepositoryTest.ResetDummyFlags();
            TruckRepositoryTest.ResetDummyFlags();
            QueueListRepositoryTest.ResetDummyFlags();
            UnitOfWorkTest.ResetDummyFlags();

            Assert.IsFalse(response.booleanResponse);
        }
        public async Task TestMethod_ImportDO_InvalidOrder()
        {
            UnitOfWorkTest.FLAG_SAVE = 1;
            SaleOrderRepositoryTest.FLAG_GET_ASYNC     = 1;
            DeliveryOrderRepositoryTest.FLAG_GET_ASYNC = 1;
            OrderRepositoryTest.FLAG_GET_ASYNC         = 0;

            var DoList   = GetSampleDoList();
            var response = await _queueService.ImportDO(DoList);

            UnitOfWorkTest.ResetDummyFlags();
            SaleOrderRepositoryTest.ResetDummyFlags();
            DeliveryOrderRepositoryTest.ResetDummyFlags();
            OrderRepositoryTest.ResetDummyFlags();

            Assert.AreNotEqual(0, response.errorCode);
        }
        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);
        }
Exemplo n.º 6
0
        public PersonBlTest()
        {
            DtoMappers.Init();

            _personDto        = new PersonDto();
            _personRepository = A.Fake <IPersonRepository>();
            _uow = new UnitOfWorkTest {
                PersonRepository = _personRepository
            };

            _person = new Person
            {
                Id        = PersonId,
                Age       = 20,
                FirstName = "First",
                LastName  = "Last",
                Sex       = true
            };
        }
        public async Task TestMethod_ImportDO_SONullAndSaveException()
        {
            UnitOfWorkTest.FLAG_SAVE = -1;
            SaleOrderRepositoryTest.FLAG_GET_ASYNC     = 0;
            DeliveryOrderRepositoryTest.FLAG_GET_ASYNC = 1;
            OrderRepositoryTest.FLAG_GET_ASYNC         = 1;
            OrderMaterialRepositoryTest.FLAG_GET_ASYNC = 1;
            MaterialRepositoryTest.FLAG_GET_ASYNC      = 1;
            MaterialRepositoryTest.FLAG_ADD            = 0;

            var DoList   = GetSampleDoList();
            var response = await _queueService.ImportDO(DoList);

            UnitOfWorkTest.ResetDummyFlags();
            SaleOrderRepositoryTest.ResetDummyFlags();
            DeliveryOrderRepositoryTest.ResetDummyFlags();
            OrderRepositoryTest.ResetDummyFlags();
            OrderMaterialRepositoryTest.ResetDummyFlags();
            MaterialRepositoryTest.ResetDummyFlags();
            MaterialRepositoryTest.ResetDummyFlags();

            Assert.AreNotEqual(0, response.errorCode);
        }
Exemplo n.º 8
0
 public void Initialize()
 {
     _unitOfWork = new UnitOfWorkTest(new TestData());
 }