Esempio n. 1
0
        [InlineData("00000000-0000-0000-0000-000000000000")] // empty Guid
        public void Get_IdIsNull(string id)
        {
            // Arrange
            var controller = new V7OrganizationController(organizationServiceMockSetup.Object, codeService, settings, logger, commonService, userService);

            // Act
            Action act = () => controller.Get(id);

            // Assert
            act.ShouldThrow <Exception>();
        }
Esempio n. 2
0
        public void Get_OrganizationNotExists()
        {
            // Arrange
            organizationServiceMockSetup.Setup(s => s.GetOrganizationById(It.IsAny <Guid>(), defaultVersion, It.IsAny <bool>())).Returns((V7VmOpenApiOrganization)null);
            var controller = new V7OrganizationController(organizationServiceMockSetup.Object, codeService, settings, logger, commonService, userService);

            // Act
            var result = controller.Get(strId);

            // Assert
            result.Should().BeOfType <NotFoundObjectResult>();
        }
Esempio n. 3
0
        public void Get_OrganizationExists()
        {
            // Arrange
            organizationServiceMockSetup.Setup(s => s.GetOrganizationById(It.IsAny <Guid>(), defaultVersion, It.IsAny <bool>())).Returns(new V7VmOpenApiOrganization());
            var controller = new V7OrganizationController(organizationServiceMockSetup.Object, codeService, settings, logger, commonService, userService);

            // Act
            var result = controller.Get(strId);

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

            Assert.IsAssignableFrom <V7VmOpenApiOrganization>(okResult.Value);
        }
Esempio n. 4
0
        public void GetOrganizations_CanCall()
        {
            // Arrange
            var pageNumber = 1;

            organizationServiceMockSetup.Setup(s => s.GetOrganizations(null, defaultVersion, pageNumber, It.IsAny <int>(), It.IsAny <bool>())).Returns(new VmOpenApiOrganizationGuidPage(pageNumber, pageSize));
            var controller = new V7OrganizationController(organizationServiceMockSetup.Object, codeService, settings, logger, commonService, userService);

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

            // Assert
            var okResult = Assert.IsType <OkObjectResult>(result);
            var model    = Assert.IsAssignableFrom <VmOpenApiOrganizationGuidPage>(okResult.Value);

            Assert.Equal(pageNumber, model.PageNumber);
        }