Esempio n. 1
0
        public void GetByYCode_CodeNotExists()
        {
            // Arrange
            organizationServiceMockSetup.Setup(s => s.GetOrganizationsByBusinessCode(It.IsAny <string>(), defaultVersion)).Returns((List <IVmOpenApiOrganizationVersionBase>)null);
            var controller = new V7OrganizationController(organizationServiceMockSetup.Object, codeService, settings, logger, commonService, userService);

            // Act
            var result = controller.GetByYCode(null);

            // Assert
            result.Should().BeOfType <NotFoundObjectResult>();
        }
Esempio n. 2
0
        public void GetByYCode_CodeExists()
        {
            // Arrange
            organizationServiceMockSetup.Setup(s => s.GetOrganizationsByBusinessCode(It.IsAny <string>(), defaultVersion)).Returns(new List <IVmOpenApiOrganizationVersionBase>()
            {
                new V7VmOpenApiOrganization()
            });
            var controller = new V7OrganizationController(organizationServiceMockSetup.Object, codeService, settings, logger, commonService, userService);

            // Act
            var result = controller.GetByYCode("code");

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

            Assert.Equal(1, model.Count());
        }