Example #1
0
        public void GetByMunicipality_ModelIsNull()
        {
            // Arrange
            var controller = new V7ServiceController(serviceServiceMockSetup.Object, commonService, codeService, settings, gdService,
                                                     fintoService, serviceAndChannelService, channelServiceMockSetup.Object, userService, logger);

            // Act
            var result = controller.GetByMunicipality(null, null);

            // Assert
            result.Should().BeOfType <NotFoundObjectResult>();
        }
Example #2
0
        public void GetByMunicipality_MunicipalityNotExists()
        {
            // Arrange
            codeServiceMockSetup.Setup(s => s.GetMunicipalityByCode(It.IsAny <string>(), It.IsAny <bool>())).Returns((VmListItem)null);
            var controller = new V7ServiceController(serviceServiceMockSetup.Object, commonService, codeService, settings, gdService,
                                                     fintoService, serviceAndChannelService, channelServiceMockSetup.Object, userService, logger);

            // Act
            var result = controller.GetByMunicipality("code", null);

            // Assert
            result.Should().BeOfType <NotFoundObjectResult>();
        }
Example #3
0
        public void GetByMunicipality_MunicipalityExists()
        {
            // Arrange
            var municipalityId = Guid.NewGuid();

            codeServiceMockSetup.Setup(s => s.GetMunicipalityByCode(It.IsAny <string>(), It.IsAny <bool>())).Returns(new VmListItem {
                Id = municipalityId
            });
            var page = 1; var pageSize = 10;

            serviceServiceMockSetup.Setup(s => s.GetServicesByMunicipality(municipalityId, null, page, pageSize)).Returns(new VmOpenApiEntityGuidPage(page, pageSize));
            var controller = new V7ServiceController(serviceServiceMockSetup.Object, commonService, codeService, settings, gdService,
                                                     fintoService, serviceAndChannelService, channelServiceMockSetup.Object, userService, logger);

            // Act
            var result = controller.GetByMunicipality(municipalityId.ToString(), null, page);

            // Assert
            result.Should().BeOfType <OkObjectResult>();
        }