public void Should_Error_Get_All_Data() { var mockFacade = new Mock <IGarmentReceiptCorrectionFacade>(); var mockMapper = new Mock <IMapper>(); GarmentReceiptCorrectionController controller = new GarmentReceiptCorrectionController(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 <IGarmentReceiptCorrectionFacade>(); mockFacade.Setup(x => x.ReadById(It.IsAny <int>())) .Returns(Model); var mockMapper = new Mock <IMapper>(); GarmentReceiptCorrectionController controller = new GarmentReceiptCorrectionController(GetServiceProvider().Object, mockFacade.Object); var response = controller.Get(It.IsAny <int>()); Assert.Equal((int)HttpStatusCode.InternalServerError, GetStatusCode(response)); }
public void Should_Success_Get_Data_By_Id() { var mockFacade = new Mock <IGarmentReceiptCorrectionFacade>(); mockFacade.Setup(x => x.ReadById(It.IsAny <int>())) .Returns(Model); var mockMapper = new Mock <IMapper>(); mockMapper.Setup(x => x.Map <GarmentReceiptCorrectionViewModel>(It.IsAny <GarmentReceiptCorrection>())) .Returns(ViewModel); GarmentReceiptCorrectionController controller = GetController(mockFacade, null, mockMapper); var response = controller.Get(It.IsAny <int>()); Assert.Equal((int)HttpStatusCode.OK, GetStatusCode(response)); }
public void Should_Success_Get_All_Data() { var mockFacade = new Mock <IGarmentReceiptCorrectionFacade>(); mockFacade.Setup(x => x.Read(It.IsAny <int>(), It.IsAny <int>(), It.IsAny <string>(), null, It.IsAny <string>())) .Returns(Tuple.Create(new List <GarmentReceiptCorrection>(), 0, new Dictionary <string, string>())); var mockMapper = new Mock <IMapper>(); mockMapper.Setup(x => x.Map <List <GarmentReceiptCorrectionViewModel> >(It.IsAny <List <GarmentReceiptCorrection> >())) .Returns(new List <GarmentReceiptCorrectionViewModel> { ViewModel }); GarmentReceiptCorrectionController controller = GetController(mockFacade, null, mockMapper); var response = controller.Get(); Assert.Equal((int)HttpStatusCode.OK, GetStatusCode(response)); }
public void Should_Error_Get_Data_By_Id() { //Setup var mockFacade = new Mock <IGarmentReceiptCorrectionFacade>(); mockFacade.Setup(x => x.ReadById(It.IsAny <int>())) .Returns(Model); var mockMapper = new Mock <IMapper>(); mockMapper .Setup(s => s.Map <GarmentReceiptCorrectionViewModel>(It.IsAny <GarmentReceiptCorrection>())) .Returns(() => null); //Act GarmentReceiptCorrectionController controller = GetController(mockFacade, null, mockMapper); var response = controller.Get(It.IsAny <int>()); //Assert Assert.Equal((int)HttpStatusCode.InternalServerError, GetStatusCode(response)); }