public void Should_Error_Get_All_Data() { var mockFacade = new Mock <IGarmentPOMasterDistributionFacade>(); mockFacade .Setup(s => s.Read(It.IsAny <int>(), It.IsAny <int>(), It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>())) .Throws(new Exception(string.Empty)); GarmentPOMasterDistributionController controller = GetController(mockFacade, null, null); IActionResult response = controller.Get(); Assert.Equal((int)HttpStatusCode.InternalServerError, GetStatusCode(response)); }
public void Should_Success_Get_All_Data() { var mockFacade = new Mock <IGarmentPOMasterDistributionFacade>(); mockFacade .Setup(s => s.Read(It.IsAny <int>(), It.IsAny <int>(), It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>())) .Returns(new ReadResponse <dynamic>(new List <dynamic>(), 1, new Dictionary <string, string>())); GarmentPOMasterDistributionController controller = GetController(mockFacade, null, null); IActionResult response = controller.Get(); Assert.Equal((int)HttpStatusCode.OK, GetStatusCode(response)); }
public void Should_Error_Get_Data_By_Id() { var mockFacade = new Mock <IGarmentPOMasterDistributionFacade>(); mockFacade.Setup(x => x.ReadById(It.IsAny <long>())) .Throws(new Exception(string.Empty)); var mockMapper = new Mock <IMapper>(); mockMapper.Setup(x => x.Map <GarmentPOMasterDistributionViewModel>(It.IsAny <GarmentPOMasterDistribution>())) .Returns(new GarmentPOMasterDistributionViewModel()); GarmentPOMasterDistributionController controller = GetController(mockFacade, mockMapper, null); IActionResult response = controller.Get(It.IsAny <long>()); Assert.Equal((int)HttpStatusCode.InternalServerError, GetStatusCode(response)); }
public void Should_Sucscess_Get_Data_By_Id() { var mockFacade = new Mock <IGarmentPOMasterDistributionFacade>(); mockFacade.Setup(x => x.ReadById(It.IsAny <long>())) .Returns(new GarmentPOMasterDistribution { }); var mockMapper = new Mock <IMapper>(); mockMapper.Setup(x => x.Map <GarmentPOMasterDistributionViewModel>(It.IsAny <GarmentPOMasterDistribution>())) .Returns(new GarmentPOMasterDistributionViewModel()); GarmentPOMasterDistributionController controller = GetController(mockFacade, mockMapper, null); IActionResult response = controller.Get(It.IsAny <long>()); Assert.Equal((int)HttpStatusCode.OK, GetStatusCode(response)); }