Beispiel #1
0
        public async Task GetDesignationWiseVolunteersByYear_WhenYearsIsZero_ShouldReturnBadRequest()
        {
            //Arrange
            var controller = new EnrollmentController(_enrollmentProcessorMock.Object);

            //Act
            var response = await controller.GetDesignationWiseVolunteersByYear(0);

            //Assert
            Assert.IsType <BadRequestResult>(response);
        }
Beispiel #2
0
        public async Task GetDesignationWiseVolunteersByYear_WhenYearsIsNotZero_ShouldReturnDesignationWiseVolunteersByYear()
        {
            //Arrange
            var lst = new List <NewRepeatedVolunteersByYear> {
                new NewRepeatedVolunteersByYear(), new NewRepeatedVolunteersByYear()
            };

            _enrollmentProcessorMock.Setup(p => p.GetDesignationWiseNewRepeatedVolunteersCountByYear(5, null)).ReturnsAsync(lst);
            var controller = new EnrollmentController(_enrollmentProcessorMock.Object);

            //Act
            var response = await controller.GetDesignationWiseVolunteersByYear(5);

            //Assert
            var okResult    = Assert.IsType <OkObjectResult>(response);
            var returnValue = Assert.IsType <List <NewRepeatedVolunteersByYear> >(okResult.Value);

            Assert.NotEmpty(returnValue);
        }