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
2 changes: 1 addition & 1 deletion .globalconfig
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ dotnet_diagnostic.CA1046.severity = none
dotnet_diagnostic.CA1047.severity = suggestion

# CA1050: Declare types in namespaces
dotnet_diagnostic.CA1050.severity = suggestion
dotnet_diagnostic.CA1050.severity = warning

# CA1051: Do not declare visible instance fields
dotnet_diagnostic.CA1051.severity = silent
Expand Down
15 changes: 9 additions & 6 deletions test/xUnit/Asserts/PriorityAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,16 @@

using System;

[AttributeUsage(AttributeTargets.Method, AllowMultiple = false)]
public class TestPriorityAttribute : Attribute
namespace PSTests.Internal
{
public TestPriorityAttribute(int priority)
[AttributeUsage(AttributeTargets.Method, AllowMultiple = false)]
public class PriorityAttribute : Attribute
{
Priority = priority;
}
public PriorityAttribute(int priority)
{
Priority = priority;
}

public int Priority { get; }
public int Priority { get; }
}
}
3 changes: 2 additions & 1 deletion test/xUnit/Asserts/PriorityOrderer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using PSTests.Internal;
using Xunit.Abstractions;
using Xunit.Sdk;

Expand All @@ -19,7 +20,7 @@ public IEnumerable<TTestCase> OrderTestCases<TTestCase>(IEnumerable<TTestCase> t
{
int priority = 0;

foreach (IAttributeInfo attr in testCase.TestMethod.Method.GetCustomAttributes(typeof(TestPriorityAttribute).AssemblyQualifiedName))
foreach (IAttributeInfo attr in testCase.TestMethod.Method.GetCustomAttributes(typeof(PriorityAttribute).AssemblyQualifiedName))
{
priority = attr.GetNamedArgument<int>("Priority");
}
Expand Down
21 changes: 11 additions & 10 deletions test/xUnit/csharp/test_PSConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
using System.Threading;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using PSTests.Internal;
using Xunit;

namespace PSTests.Sequential
Expand Down Expand Up @@ -382,7 +383,7 @@ public PowerShellPolicyTests(PowerShellPolicyFixture fixture)
this.fixture = fixture;
}

[Fact, TestPriority(1)]
[Fact, Priority(1)]
public void PowerShellConfig_GetPowerShellPolicies_BothConfigFilesNotEmpty()
{
fixture.SetupConfigFile1();
Expand All @@ -398,7 +399,7 @@ public void PowerShellConfig_GetPowerShellPolicies_BothConfigFilesNotEmpty()
fixture.CompareTwoPolicies(userPolicies, fixture.CurrentUserPolicies);
}

[Fact, TestPriority(2)]
[Fact, Priority(2)]
public void PowerShellConfig_GetPowerShellPolicies_EmptyUserConfig()
{
fixture.SetupConfigFile2();
Expand All @@ -413,7 +414,7 @@ public void PowerShellConfig_GetPowerShellPolicies_EmptyUserConfig()
fixture.CompareTwoPolicies(sysPolicies, fixture.SystemWidePolicies);
}

[Fact, TestPriority(3)]
[Fact, Priority(3)]
public void PowerShellConfig_GetPowerShellPolicies_EmptySystemConfig()
{
fixture.SetupConfigFile3();
Expand All @@ -428,7 +429,7 @@ public void PowerShellConfig_GetPowerShellPolicies_EmptySystemConfig()
fixture.CompareTwoPolicies(userPolicies, fixture.CurrentUserPolicies);
}

[Fact, TestPriority(4)]
[Fact, Priority(4)]
public void PowerShellConfig_GetPowerShellPolicies_BothConfigFilesEmpty()
{
fixture.SetupConfigFile4();
Expand All @@ -441,7 +442,7 @@ public void PowerShellConfig_GetPowerShellPolicies_BothConfigFilesEmpty()
Assert.Null(userPolicies);
}

[Fact, TestPriority(5)]
[Fact, Priority(5)]
public void PowerShellConfig_GetPowerShellPolicies_BothConfigFilesNotExist()
{
fixture.CleanupConfigFiles();
Expand All @@ -454,7 +455,7 @@ public void PowerShellConfig_GetPowerShellPolicies_BothConfigFilesNotExist()
Assert.Null(userPolicies);
}

[Fact, TestPriority(6)]
[Fact, Priority(6)]
public void Utils_GetPolicySetting_BothConfigFilesNotEmpty()
{
fixture.SetupConfigFile1();
Expand Down Expand Up @@ -553,7 +554,7 @@ public void Utils_GetPolicySetting_BothConfigFilesNotEmpty()
fixture.CompareConsoleSessionConfiguration(consoleSessionConfiguration, fixture.SystemWidePolicies.ConsoleSessionConfiguration);
}

[Fact, TestPriority(7)]
[Fact, Priority(7)]
public void Utils_GetPolicySetting_EmptyUserConfig()
{
fixture.SetupConfigFile2();
Expand Down Expand Up @@ -652,7 +653,7 @@ public void Utils_GetPolicySetting_EmptyUserConfig()
fixture.CompareConsoleSessionConfiguration(consoleSessionConfiguration, fixture.SystemWidePolicies.ConsoleSessionConfiguration);
}

[Fact, TestPriority(8)]
[Fact, Priority(8)]
public void Utils_GetPolicySetting_EmptySystemConfig()
{
fixture.SetupConfigFile3();
Expand Down Expand Up @@ -752,7 +753,7 @@ public void Utils_GetPolicySetting_EmptySystemConfig()
fixture.CompareConsoleSessionConfiguration(consoleSessionConfiguration, null);
}

[Fact, TestPriority(9)]
[Fact, Priority(9)]
public void Utils_GetPolicySetting_BothConfigFilesEmpty()
{
fixture.SetupConfigFile4();
Expand Down Expand Up @@ -852,7 +853,7 @@ public void Utils_GetPolicySetting_BothConfigFilesEmpty()
fixture.CompareConsoleSessionConfiguration(consoleSessionConfiguration, null);
}

[Fact, TestPriority(10)]
[Fact, Priority(10)]
public void Utils_GetPolicySetting_BothConfigFilesNotExist()
{
fixture.CleanupConfigFiles();
Expand Down