コード例 #1
0
        public async Task GetYearlyBuWiseVolunteersCount_WhenYearsIsZero_ShouldReturnBadRequest()
        {
            //Arrange
            var controller = new EnrollmentController(_enrollmentProcessorMock.Object);

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

            //Assert
            Assert.IsType <BadRequestResult>(response);
        }
コード例 #2
0
        public async Task GetYearlyBuWiseVolunteersCount_WhenYearsIsNotZero_ShouldReturnEnrollmentsOnGivenYears()
        {
            //Arrange
            var dict = new Dictionary <string, int>();

            dict.Add("key", 15);
            var dictList = new List <Dictionary <string, int> > {
                dict
            };

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

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

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

            Assert.NotEmpty(returnValue);
        }