コード例 #1
0
        public void GetEffectiveCoresCount_RetrunsExpectedResult()
        {
            TestEnvironment env = new TestEnvironment();

            Assert.Equal(Environment.ProcessorCount, EnvironmentExtensions.GetEffectiveCoresCount(env));

            env.Clear();
            env.SetEnvironmentVariable(EnvironmentSettingNames.AzureWebsiteSku, ScriptConstants.DynamicSku);
            Assert.Equal(1, EnvironmentExtensions.GetEffectiveCoresCount(env));

            env.Clear();
            env.SetEnvironmentVariable(EnvironmentSettingNames.AzureWebsiteSku, ScriptConstants.DynamicSku);
            env.SetEnvironmentVariable(EnvironmentSettingNames.RoleInstanceId, "dw0SmallDedicatedWebWorkerRole_hr0HostRole-0-VM-1");
            Assert.Equal(Environment.ProcessorCount, EnvironmentExtensions.GetEffectiveCoresCount(env));
        }