예제 #1
0
        public async Task FindById__if_report_not_found__Return_NotFound_Status()
        {
            // Arrange
            int model = 1;

            IConfirmationReportWorker worker = Substitute.For <IConfirmationReportWorker>();

            worker.FindById(model).Returns(null as ConfirmationReportViewModel);
            var controller = new ConfirmationReportController(worker);

            // Act
            var actual = await controller.FindById(model);

            // Assert
            Assert.IsAssignableFrom <NotFoundResult>(actual);
        }
예제 #2
0
        public async Task FindById__if_report_found__Return_Ok_Status()
        {
            // Arrange
            int model = 1;

            IConfirmationReportWorker worker = Substitute.For <IConfirmationReportWorker>();

            worker.FindById(model).Returns(new ConfirmationReportViewModel {
                Id = 1
            });

            var controller = new ConfirmationReportController(worker);

            // Act
            var actual = await controller.FindById(model);

            // Assert
            Assert.IsAssignableFrom <OkNegotiatedContentResult <ConfirmationReportViewModel> >(actual);
        }
예제 #3
0
        public async Task FindById__if_report_found__Return_report_with_same_reportNumber()
        {
            // Arrange
            int model = 1;

            IConfirmationReportWorker worker = Substitute.For <IConfirmationReportWorker>();

            worker.FindById(model).Returns(new ConfirmationReportViewModel {
                Id = 1
            });

            var controller = new ConfirmationReportController(worker);

            // Act
            var actual = await controller.FindById(model) as OkNegotiatedContentResult <ConfirmationReportViewModel>;

            // Assert
            Assert.IsNotNull(actual.Content);
            Assert.AreEqual(model, actual.Content.Id);
        }