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

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

            //Assert
            Assert.IsType <BadRequestResult>(response);
        }
示例#2
0
        public async Task GetYearlyVolunteersCount_WhenValidYearsCountPassed_ShouldReturnEnrollmentsOnGivenYears()
        {
            //Arrange
            var dict = new Dictionary <int, List <int> >();

            dict.Add(1, new List <int> {
                1, 2
            });
            _enrollmentProcessorMock.Setup(p => p.GetYearlyVolunteersCount(5, null)).ReturnsAsync(dict);
            var controller = new EnrollmentController(_enrollmentProcessorMock.Object);

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

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

            Assert.NotEmpty(returnValue);
        }