Skip to content
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 @@ -30,6 +30,14 @@ public class EnableDisableExperimentalFeatureCommandBase : PSCmdlet
/// </summary>
[Parameter]
public ConfigScope Scope { get; set; } = ConfigScope.CurrentUser;

/// <summary>
/// EndProcessing method.
/// </summary>
protected override void EndProcessing()
{
WriteWarning(ExperimentalFeatureStrings.ExperimentalFeaturePending);
}
}

/// <summary>
Expand Down Expand Up @@ -87,8 +95,6 @@ internal static void UpdateConfig(PSCmdlet cmdlet, string[] name, ConfigScope sc
cmdlet.WriteError(new ErrorRecord(new ItemNotFoundException(errMsg), "ItemNotFoundException", ErrorCategory.ObjectNotFound, name));
return;
}

cmdlet.WriteWarning(ExperimentalFeatureStrings.ExperimentalFeaturePending);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,4 +94,14 @@ Describe "Enable-ExperimentalFeature and Disable-ExperimentalFeature tests" -tag
& $cmdlet ExpTest.FeatureOne -WarningVariable warning -WarningAction SilentlyContinue
$warning | Should -Not -BeNullOrEmpty -Because "A warning message is always given indicating restart is required"
}

It "Multiple features enabled will only output one warning message for <cmdlet>" -TestCases @(
@{ cmdlet = "Enable-ExperimentalFeature" },
@{ cmdlet = "Disable-Experimentalfeature" }
) {
param ($cmdlet)

Get-ExperimentalFeature | & $cmdlet -WarningAction SilentlyContinue -WarningVariable warning
$warning | Should -HaveCount 1
}
}