Пример #1
0
        public void Should_ThrowsException_GetReport()
        {
            //Setup
            var mockFacade = new Mock <IUnitReceiptNoteFacade>();

            mockFacade.Setup(x => x.GetReport(It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>(), It.IsAny <DateTime>(), It.IsAny <DateTime>(), It.IsAny <int>(), It.IsAny <int>(), It.IsAny <string>(), It.IsAny <int>()))
            .Throws(new Exception());

            var mockMapper = new Mock <IMapper>();

            //Act
            UnitReceiptNoteReportController controller = GetController(mockFacade, GetServiceProvider(), mockMapper);
            var response = controller.GetReport(It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>(), It.IsAny <DateTime>(), It.IsAny <DateTime>(), It.IsAny <int>(), It.IsAny <int>(), "{}");

            //Assert
            Assert.Equal((int)HttpStatusCode.InternalServerError, GetStatusCode(response));
        }
Пример #2
0
        public void Should_Success_Get_All_Data()
        {
            var mockFacade = new Mock <IUnitReceiptNoteFacade>();

            mockFacade.Setup(x => x.GetReport(It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>(), It.IsAny <DateTime>(), It.IsAny <DateTime>(), It.IsAny <int>(), It.IsAny <int>(), It.IsAny <string>(), It.IsAny <int>()))
            .Returns(new ReadResponse <UnitReceiptNoteReportViewModel>(new List <UnitReceiptNoteReportViewModel>()
            {
                new UnitReceiptNoteReportViewModel()
            }, 1, new Dictionary <string, string>()));

            var mockMapper = new Mock <IMapper>();

            UnitReceiptNoteReportController controller = GetController(mockFacade, GetServiceProvider(), mockMapper);
            var response = controller.GetReport(It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>(), It.IsAny <DateTime>(), It.IsAny <DateTime>(), It.IsAny <int>(), It.IsAny <int>(), "{}");

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