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
3 changes: 1 addition & 2 deletions src/Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,8 @@
<!-- Tests -->
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="18.0.1" />
<PackageVersion Include="System.Reflection.MetadataLoadContext" Version="10.0.3" />
<PackageVersion Include="xunit" Version="2.9.3" />
<PackageVersion Include="xunit.v3" Version="3.2.2" />
<PackageVersion Include="xunit.runner.visualstudio" Version="3.1.5" />
<PackageVersion Include="Xunit.SkippableFact" Version="1.5.61" />
<!-- Misc -->
<PackageVersion Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.3" />
</ItemGroup>
Expand Down
7 changes: 3 additions & 4 deletions src/Microsoft.Unity.Analyzers.Tests/ConsistencyTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.Diagnostics;
using Xunit;
using Xunit.Abstractions;

namespace Microsoft.Unity.Analyzers.Tests;

Expand Down Expand Up @@ -124,12 +123,12 @@ public async Task CheckHelpLinks()
Assert.NotEmpty(d.HelpLinkUri);
Assert.Contains(d.Id, d.HelpLinkUri);

var response = await client.GetAsync(d.HelpLinkUri);
var response = await client.GetAsync(d.HelpLinkUri, TestContext.Current.CancellationToken);
Assert.True(response.IsSuccessStatusCode);
}
}

[SkippableFact]
[Fact]
public void CheckCodeFixTestsHaveTriviaTests()
{
var assembly = typeof(ConsistencyTests).Assembly;
Expand All @@ -153,7 +152,7 @@ public void CheckCodeFixTestsHaveTriviaTests()
missingTriviaTests.Add(testClass.Name);
}

Skip.If(missingTriviaTests.Any(), $"The following CodeFix test classes ({(float)missingTriviaTests.Count / codeFixTestClasses.Length:0.00%}) are missing a Trivia test:\n\n{string.Join("\n", missingTriviaTests)}");
Assert.SkipWhen(missingTriviaTests.Any(), $"The following CodeFix test classes ({(float)missingTriviaTests.Count / codeFixTestClasses.Length:0.00%}) are missing a Trivia test:\n\n{string.Join("\n", missingTriviaTests)}");
}

private static bool IsBaseCodeFixVerifierTest(Type type)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ namespace Microsoft.Unity.Analyzers.Tests;
public class GetLocalPositionAndRotationTests : BaseCodeFixVerifierTest<GetLocalPositionAndRotationAnalyzer, GetLocalPositionAndRotationCodeFix>
{
// For extensive testing, see GetPositionAndRotationTests
[SkippableFact]
[Fact]
public async Task UseGetLocalPositionAndRotationMethod()
{
const string test = @"
Expand All @@ -31,7 +31,7 @@ void Update()
var method = GetCSharpDiagnosticAnalyzer().ExpressionContext.PositionAndRotationMethodName;
var type = typeof(UnityEngine.Transform);

Skip.IfNot(MethodExists("UnityEngine", type.FullName!, method), $"This Unity version does not support {type}.{method}");
Assert.SkipUnless(MethodExists("UnityEngine", type.FullName!, method), $"This Unity version does not support {type}.{method}");

var diagnostic = ExpectDiagnostic().WithLocation(9, 9);

Expand All @@ -53,7 +53,7 @@ void Update()
await VerifyCSharpFixAsync(test, fixedTest);
}

[SkippableFact]
[Fact]
public async Task UseGetLocalPositionAndRotationMethodTransformAccess()
{
const string test = @"
Expand All @@ -73,7 +73,7 @@ void Method()
var method = GetCSharpDiagnosticAnalyzer().ExpressionContext.PositionAndRotationMethodName;
var type = typeof(UnityEngine.Jobs.TransformAccess);

Skip.IfNot(MethodExists("UnityEngine", type.FullName!, method), $"This Unity version does not support {type}.{method}");
Assert.SkipUnless(MethodExists("UnityEngine", type.FullName!, method), $"This Unity version does not support {type}.{method}");

var diagnostic = ExpectDiagnostic().WithLocation(9, 9);

Expand All @@ -95,7 +95,7 @@ void Method()
await VerifyCSharpFixAsync(test, fixedTest);
}

[SkippableFact]
[Fact]
public async Task NoTypeMismatch()
{
const string test = @"
Expand All @@ -116,7 +116,7 @@ void Update()
await VerifyCSharpDiagnosticAsync(test);
}

[SkippableFact]
[Fact]
public async Task UseGetLocalPositionAndRotationMethodTrivia()
{
const string test = @"
Expand All @@ -139,7 +139,7 @@ void Update()
var method = GetCSharpDiagnosticAnalyzer().ExpressionContext.PositionAndRotationMethodName;
var type = typeof(UnityEngine.Transform);

Skip.IfNot(MethodExists("UnityEngine", type.FullName!, method), $"This Unity version does not support {type}.{method}");
Assert.SkipUnless(MethodExists("UnityEngine", type.FullName!, method), $"This Unity version does not support {type}.{method}");

var diagnostic = ExpectDiagnostic().WithLocation(10, 9);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ void Update()
await VerifyCSharpFixAsync(test, fixedTest);
}

[SkippableFact]
[Fact]
public async Task UseGetPositionAndRotationMethodTransformAccess()
{
const string test = @"
Expand All @@ -72,7 +72,7 @@ void Method()
var method = GetCSharpDiagnosticAnalyzer().ExpressionContext.PositionAndRotationMethodName;
var type = typeof(UnityEngine.Jobs.TransformAccess);

Skip.IfNot(MethodExists("UnityEngine", type.FullName!, method), $"This Unity version does not support {type}.{method}");
Assert.SkipUnless(MethodExists("UnityEngine", type.FullName!, method), $"This Unity version does not support {type}.{method}");

var diagnostic = ExpectDiagnostic().WithLocation(12, 9);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net10.0</TargetFramework>
<Nullable>enable</Nullable>
<NoWarn>NU1608;VSTHRD200</NoWarn>
Expand All @@ -12,9 +13,8 @@
<PackageReference Include="Microsoft.NET.Test.Sdk" />
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" PrivateAssets="All" />
<PackageReference Include="System.Reflection.MetadataLoadContext" />
<PackageReference Include="xunit" />
<PackageReference Include="xunit.v3" />
<PackageReference Include="xunit.runner.visualstudio" PrivateAssets="all" />
<PackageReference Include="Xunit.SkippableFact" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ namespace Microsoft.Unity.Analyzers.Tests;
public class SetLocalPositionAndRotationTests : BaseCodeFixVerifierTest<SetLocalPositionAndRotationAnalyzer, SetLocalPositionAndRotationCodeFix>
{
// For extensive testing, see SetPositionAndRotationTests.cs
[SkippableFact]
[Fact]
public async Task UpdateLocalPositionAndRotationMethod()
{
const string test = @"
Expand All @@ -30,7 +30,7 @@ void Update()
var method = GetCSharpDiagnosticAnalyzer().ExpressionContext.PositionAndRotationMethodName;
var type = typeof(UnityEngine.Transform);

Skip.IfNot(MethodExists("UnityEngine", type.FullName!, method), $"This Unity version does not support {type}.{method}");
Assert.SkipUnless(MethodExists("UnityEngine", type.FullName!, method), $"This Unity version does not support {type}.{method}");

var diagnostic = ExpectDiagnostic().WithLocation(8, 9);

Expand All @@ -51,7 +51,7 @@ void Update()
await VerifyCSharpFixAsync(test, fixedTest);
}

[SkippableFact]
[Fact]
public async Task UpdateLocalPositionAndRotationMethodTransformAccess()
{
const string test = @"
Expand All @@ -72,7 +72,7 @@ void Method()
var method = GetCSharpDiagnosticAnalyzer().ExpressionContext.PositionAndRotationMethodName;
var type = typeof(UnityEngine.Jobs.TransformAccess);

Skip.IfNot(MethodExists("UnityEngine", type.FullName!, method), $"This Unity version does not support {type}.{method}");
Assert.SkipUnless(MethodExists("UnityEngine", type.FullName!, method), $"This Unity version does not support {type}.{method}");

var diagnostic = ExpectDiagnostic().WithLocation(10, 9);

Expand All @@ -95,7 +95,7 @@ void Method()
await VerifyCSharpFixAsync(test, fixedTest);
}

[SkippableFact]
[Fact]
public async Task UpdateLocalPositionAndRotationMethodTrivia()
{
const string test = @"
Expand All @@ -116,7 +116,7 @@ void Update()
var method = GetCSharpDiagnosticAnalyzer().ExpressionContext.PositionAndRotationMethodName;
var type = typeof(UnityEngine.Transform);

Skip.IfNot(MethodExists("UnityEngine", type.FullName!, method), $"This Unity version does not support {type}.{method}");
Assert.SkipUnless(MethodExists("UnityEngine", type.FullName!, method), $"This Unity version does not support {type}.{method}");

var diagnostic = ExpectDiagnostic().WithLocation(9, 9);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ void Update()
await VerifyCSharpFixAsync(test, fixedTest);
}

[SkippableFact]
[Fact]
public async Task UpdatePositionAndRotationMethodTransformAccess()
{
const string test = @"
Expand All @@ -66,7 +66,7 @@ void Method()
var method = GetCSharpDiagnosticAnalyzer().ExpressionContext.PositionAndRotationMethodName;
var type = typeof(UnityEngine.Jobs.TransformAccess);

Skip.IfNot(MethodExists("UnityEngine", type.FullName!, method), $"This Unity version does not support {type}.{method}");
Assert.SkipUnless(MethodExists("UnityEngine", type.FullName!, method), $"This Unity version does not support {type}.{method}");

var diagnostic = ExpectDiagnostic().WithLocation(10, 9);

Expand Down
Loading