Esempio n. 1
0
        public void GetByMunicipality_ModelIsNull()
        {
            // Arrange
            var controller = new V7OrganizationController(organizationServiceMockSetup.Object, codeService, settings, logger, commonService, userService);

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

            // Assert
            result.Should().BeOfType <NotFoundObjectResult>();
        }
Esempio n. 2
0
        public void GetByMunicipality_MunicipalityNotExists()
        {
            // Arrange
            codeServiceMockSetup.Setup(s => s.GetMunicipalityByCode(It.IsAny <string>(), It.IsAny <bool>())).Returns((VmListItem)null);
            var controller = new V7OrganizationController(organizationServiceMockSetup.Object, codeService, settings, logger, commonService, userService);

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

            // Assert
            result.Should().BeOfType <NotFoundObjectResult>();
        }
Esempio n. 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;

            organizationServiceMockSetup.Setup(s => s.GetOrganizationsByMunicipality(municipalityId, null, page, pageSize)).Returns(new VmOpenApiOrganizationGuidPage(page, pageSize));
            var controller = new V7OrganizationController(organizationServiceMockSetup.Object, codeService, settings, logger, commonService, userService);

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

            // Assert
            var okResult = Assert.IsType <OkObjectResult>(result);

            Assert.IsAssignableFrom <VmOpenApiOrganizationGuidPage>(okResult.Value);
        }