示例#1
0
        public void PreloadAmazonElasticBeanstalk_With_Default_Arguments_Returns_Builder(bool stdoutEnabled)
        {
            // Arrange
            var mockBuilder = new Mock <IAndcultureCodeWebHostBuilder>();

            // Act
            var result = IAndcultureCodeWebHostBuilderExtensions.PreloadAmazonElasticBeanstalk(mockBuilder.Object, stdoutEnabled);

            // Assert
            result.ShouldBe(mockBuilder.Object);
        }
示例#2
0
        public void PreloadAmazonElasticBeanstalk_When_Contains_AspNetCore_Environment_Sets_Global_EnvironmentVariable()
        {
            // Arrange
            var expected     = $"testValue{Random.Int()}";
            var mockBuilder  = new Mock <IAndcultureCodeWebHostBuilder>();
            var mockProvider = new Mock <AmazonEBConfigurationProvider>();

            mockProvider.Setup(e => e.Has(IAndcultureCodeWebHostBuilderExtensions.ASPNETCORE_ENVIRONMENT)).Returns(true);
            mockProvider.Setup(e => e.Get(IAndcultureCodeWebHostBuilderExtensions.ASPNETCORE_ENVIRONMENT)).Returns(expected);

            // Act
            var result = IAndcultureCodeWebHostBuilderExtensions.PreloadAmazonElasticBeanstalk(
                builder: mockBuilder.Object,
                stdoutEnabled: false,
                configurationProvider: mockProvider.Object
                );

            // Assert
            result.ShouldNotBeNull();
            Environment.GetEnvironmentVariable(IAndcultureCodeWebHostBuilderExtensions.ASPNETCORE_ENVIRONMENT).ShouldBe(expected);
        }