Ejemplo n.º 1
0
        public void CreateEnvironment_Invalid_EnvironmentName_Or_TenantId(string environmentName, int tenantId)
        {
            //Given
            Environments env = new Environments {
                Environment = environmentName
            };

            //When
            var controller = new EnvironmentController(logger.Object, environmentServiceMoq.Object);
            var response   = controller.CreateCustomEnvironment(env, tenantId) as BadRequestObjectResult;

            //Then
            Assert.IsType <BadRequestObjectResult>(response);
            Assert.Equal($"Invalid TenantId : {tenantId} or environment name : {env.Environment}", response.Value);
        }
Ejemplo n.º 2
0
        public void CreateEnvironment_UnSuccessful()
        {
            //Given
            Environments env = new Environments {
                Environment = "Custom Dev"
            };
            int tenantId = 1, envCreatedCount = 0;

            environmentServiceMoq.Setup(e => e.CreateEnvironment(env, tenantId)).Returns(envCreatedCount);

            //When
            var controller = new EnvironmentController(logger.Object, environmentServiceMoq.Object);
            var response   = controller.CreateCustomEnvironment(env, tenantId) as NotFoundObjectResult;

            //Then
            Assert.IsType <NotFoundObjectResult>(response);
            Assert.Equal($"Environments failed to insert", response.Value);
            environmentServiceMoq.Verify(e => e.CreateEnvironment(env, tenantId), Times.Once);
        }