public void Should_Error_Get_All_Data()
        {
            var mockFacade = new Mock <IGarmentUnitDeliveryOrderFacade>();

            GarmentUnitDeliveryOrderControllers controller = new GarmentUnitDeliveryOrderControllers(GetServiceProvider().Object, mockFacade.Object);

            var response = controller.Get();

            Assert.Equal((int)HttpStatusCode.InternalServerError, GetStatusCode(response));
        }
        public void Should_Error_Get_Data_By_Id()
        {
            var mockFacade = new Mock <IGarmentUnitDeliveryOrderFacade>();

            mockFacade.Setup(x => x.ReadById(It.IsAny <int>()))
            .Returns(new GarmentUnitDeliveryOrder());

            GarmentUnitDeliveryOrderControllers controller = new GarmentUnitDeliveryOrderControllers(GetServiceProvider().Object, mockFacade.Object);

            var response = controller.Get(It.IsAny <int>());

            Assert.Equal((int)HttpStatusCode.InternalServerError, GetStatusCode(response));
        }
        public void Should_Success_Get_All_Data()
        {
            var mockFacade = new Mock <IGarmentUnitDeliveryOrderFacade>();

            mockFacade.Setup(x => x.Read(It.IsAny <int>(), It.IsAny <int>(), It.IsAny <string>(), null, It.IsAny <string>()))
            .Returns(new ReadResponse <object>(new List <object>(), 1, new Dictionary <string, string>()));

            GarmentUnitDeliveryOrderControllers controller = GetController(mockFacade);

            var response = controller.Get();

            Assert.Equal((int)HttpStatusCode.OK, GetStatusCode(response));
        }
Example #4
0
        public void Should_Sucscess_Get_Data_By_Id()
        {
            var mockFacade = new Mock <IGarmentUnitDeliveryOrder>();

            mockFacade.Setup(x => x.ReadById(It.IsAny <int>()))
            .Returns(Model);

            var mockMapper = new Mock <IMapper>();

            mockMapper.Setup(x => x.Map <GarmentUnitDeliveryOrderViewModel>(It.IsAny <GarmentUnitDeliveryOrder>()))
            .Returns(ViewModel);

            GarmentUnitDeliveryOrderControllers controller = GetController(mockFacade, null, mockMapper);
            var response = controller.Get(It.IsAny <int>());

            Assert.Equal((int)HttpStatusCode.OK, GetStatusCode(response));
        }
Example #5
0
        public void Should_Success_Get_All_Data()
        {
            var mockFacade = new Mock <IGarmentUnitDeliveryOrder>();

            mockFacade.Setup(x => x.Read(It.IsAny <int>(), It.IsAny <int>(), It.IsAny <string>(), null, It.IsAny <string>()))
            .Returns(Tuple.Create(new List <GarmentUnitDeliveryOrder>(), 0, new Dictionary <string, string>()));

            var mockMapper = new Mock <IMapper>();

            mockMapper.Setup(x => x.Map <List <GarmentUnitDeliveryOrderViewModel> >(It.IsAny <List <GarmentUnitDeliveryOrder> >()))
            .Returns(new List <GarmentUnitDeliveryOrderViewModel> {
                ViewModel
            });

            GarmentUnitDeliveryOrderControllers controller = GetController(mockFacade, null, mockMapper);
            var response = controller.Get();

            Assert.Equal((int)HttpStatusCode.OK, GetStatusCode(response));
        }