Пример #1
0
        public void Configure_InStandbyMode_ReturnsExpectedConfiguration()
        {
            ScriptApplicationHostOptionsSetup setup = CreateSetupWithConfiguration(true);

            var options = new ScriptApplicationHostOptions();

            setup.Configure(options);

            Assert.EndsWith(@"functions\standby\logs", options.LogPath);
            Assert.EndsWith(@"functions\standby\wwwroot", options.ScriptPath);
            Assert.EndsWith(@"functions\standby\secrets", options.SecretsPath);
            Assert.False(options.IsSelfHost);
        }
Пример #2
0
        public void Configure_InStandbyMode_ReturnsExpectedConfiguration()
        {
            var settings = new Dictionary <string, string>
            {
                { EnvironmentSettingNames.AzureWebsitePlaceholderMode, "1" }
            };

            ScriptApplicationHostOptionsSetup setup = CreateSetupWithConfiguration(new TestEnvironment(settings));

            var options = new ScriptApplicationHostOptions();

            setup.Configure(options);

            Assert.EndsWith(@"functions\standby\logs", options.LogPath);
            Assert.EndsWith(@"functions\standby\wwwroot", options.ScriptPath);
            Assert.EndsWith(@"functions\standby\secrets", options.SecretsPath);
            Assert.False(options.IsSelfHost);
        }
Пример #3
0
        private ScriptApplicationHostOptions CreateConfiguredOptions(bool inStandbyMode, IEnvironment environment = null)
        {
            var builder       = new ConfigurationBuilder();
            var configuration = builder.Build();

            var standbyOptions = new TestOptionsMonitor <StandbyOptions>(new StandbyOptions {
                InStandbyMode = inStandbyMode
            });
            var mockCache           = new Mock <IOptionsMonitorCache <ScriptApplicationHostOptions> >();
            var mockServiceProvider = new Mock <IServiceProvider>();
            var mockEnvironment     = environment ?? new TestEnvironment();
            var setup = new ScriptApplicationHostOptionsSetup(configuration, standbyOptions, mockCache.Object, mockServiceProvider.Object, mockEnvironment);

            var options = new ScriptApplicationHostOptions();

            setup.Configure(options);
            return(options);
        }