public async Task Should_Error_Create_Data()
        {
            var validateMock = new Mock <IValidateService>();

            validateMock.Setup(s => s.Validate(It.IsAny <GarmentUnitDeliveryOrderViewModel>())).Verifiable();

            var mockFacade = new Mock <IGarmentUnitDeliveryOrderFacade>();

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

            var response = await controller.Post(this.ViewModel);

            Assert.Equal((int)HttpStatusCode.InternalServerError, GetStatusCode(response));
        }
示例#2
0
        public void Should_Error_Create_Data()
        {
            var validateMock = new Mock <IValidateService>();

            validateMock.Setup(s => s.Validate(It.IsAny <GarmentUnitDeliveryOrderViewModel>())).Verifiable();

            var mockMapper = new Mock <IMapper>();

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

            var mockFacade = new Mock <IGarmentUnitDeliveryOrder>();

            mockFacade.Setup(x => x.Create(It.IsAny <GarmentUnitDeliveryOrder>(), "unittestusername", 7))
            .ReturnsAsync(1);

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

            var response = controller.Post(this.ViewModel).Result;

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