Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix singleton #3389

Merged
merged 4 commits into from
Feb 20, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ internal partial class FeatureFlag : IFeatureFlag
{
private static readonly Dictionary<string, bool> FeatureFlags = new();

private const string Prefix = "VSTEST_FEATURE_";
private const string VSTEST_FEATURE = nameof(VSTEST_FEATURE);

public static IFeatureFlag Instance => new FeatureFlag();
public static IFeatureFlag Instance { get; } = new FeatureFlag();
MarcoRossignoli marked this conversation as resolved.
Show resolved Hide resolved

static FeatureFlag()
{
Expand All @@ -24,12 +24,12 @@ static FeatureFlag()

// Added for artifact porst-processing, it enable/disable the post processing.
// Added in 17.2-preview 7.0-preview
public static string ARTIFACTS_POSTPROCESSING = Prefix + "ARTIFACTS_POSTPROCESSING";
public static string ARTIFACTS_POSTPROCESSING = VSTEST_FEATURE + "_" + "ARTIFACTS_POSTPROCESSING";

// Added for artifact porst-processing, it will show old output for dotnet sdk scenario.
// It can be useful if we need to restore old UX in case users are parsing the console output.
// Added in 17.2-preview 7.0-preview
public static string ARTIFACTS_POSTPROCESSING_SDK_KEEP_OLD_UX = Prefix + "ARTIFACTS_POSTPROCESSING_SDK_KEEP_OLD_UX";
public static string ARTIFACTS_POSTPROCESSING_SDK_KEEP_OLD_UX = VSTEST_FEATURE + "_" + "ARTIFACTS_POSTPROCESSING_SDK_KEEP_OLD_UX";

// For now we're checking env var.
// We could add it also to some section inside the runsettings.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

namespace Microsoft.TestPlatform.CoreUtilities.UnitTests.FeatureFlag;

using Microsoft.VisualStudio.TestTools.UnitTesting;
using Microsoft.VisualStudio.TestPlatform.Utilities;

[TestClass]
public class FeatureFlagTests
{
[TestMethod]
public void SingletonAlwaysReturnsTheSameInstance()
{
Assert.IsTrue(ReferenceEquals(FeatureFlag.Instance, FeatureFlag.Instance));
}
}