Skip to content

Commit

Permalink
Merge pull request #503 from y-iihoshi/dependabot/nuget/MSTest-3.6.0
Browse files Browse the repository at this point in the history
build(deps): bump MSTest from 3.5.2 to 3.6.0
  • Loading branch information
y-iihoshi authored Sep 14, 2024
2 parents 1a77fae + 104f7d1 commit 96c18d2
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="MSTest" Version="3.5.2" />
<PackageReference Include="MSTest" Version="3.6.0" />
<PackageReference Include="NSubstitute" Version="5.1.0" />
<PackageReference Include="NSubstitute.Analyzers.CSharp" Version="1.0.17">
<PrivateAssets>all</PrivateAssets>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public void InstanceTest()
Assert.IsNotNull(instance);
}

[STATestMethod]
[SkipOrSTATestMethod]
public void CanExecuteTest()
{
var instance = CloseWindowCommand.Instance;
Expand All @@ -37,7 +37,7 @@ public void CanExecuteTestInvalid()
Assert.IsFalse(instance.CanExecute(5));
}

[STATestMethod]
[SkipOrSTATestMethod]
public void ExecuteTest()
{
var instance = CloseWindowCommand.Instance;
Expand Down Expand Up @@ -73,7 +73,7 @@ public void ExecuteTestInvalid()
instance.Execute(5);
}

[STATestMethod]
[SkipOrSTATestMethod]
public void CanExecuteChangedTest()
{
var instance = CloseWindowCommand.Instance;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public void CancelCommandTest()
Assert.AreSame(command, action.CancelCommand);
}

[STATestMethod]
[SkipOrSTATestMethod]
public void OwnerTest()
{
var action = new DerivedAction();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ private void RaisePropertyChanged([CallerMemberName] string propertyName = "")
[TestClass]
public class TextBoxBaseScrollBehaviorTests
{
[STATestMethod]
[SkipOrSTATestMethod]
public void AutoScrollToEndTest()
{
var logger = new Logger();
Expand Down Expand Up @@ -79,7 +79,7 @@ static void onLayoutUpdated(object? sender, EventArgs eventArgs)
BindingOperations.ClearBinding(textbox, TextBox.TextProperty);
}

[STATestMethod]
[SkipOrSTATestMethod]
public void NotAutoScrollToEndTest()
{
var logger = new Logger();
Expand Down
4 changes: 2 additions & 2 deletions ThScoreFileConverter.Tests/Interactivity/Win32WindowTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace ThScoreFileConverter.Tests.Interactivity;
[TestClass]
public class Win32WindowTests
{
[STATestMethod]
[SkipOrSTATestMethod]
public void Win32WindowTest()
{
var window = new Window();
Expand All @@ -21,7 +21,7 @@ public void Win32WindowTest()
Assert.AreEqual(handle, win32window.Handle);
}

[STATestMethod]
[SkipOrSTATestMethod]
public void Win32WindowTestDefault()
{
var window = new Window();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="MSTest" Version="3.5.2" />
<PackageReference Include="MSTest" Version="3.6.0" />
<PackageReference Include="NSubstitute" Version="5.1.0" />
<PackageReference Include="NSubstitute.Analyzers.CSharp" Version="1.0.17">
<PrivateAssets>all</PrivateAssets>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
using System.Threading;
namespace ThScoreFileConverter.Tests.UnitTesting;

namespace ThScoreFileConverter.Tests.UnitTesting;

public sealed class STATestMethodAttribute : TestMethodAttribute
public sealed class SkipOrSTATestMethodAttribute : STATestMethodAttribute
{
public override TestResult[] Execute(ITestMethod testMethod)
{
Expand All @@ -18,15 +16,7 @@ public override TestResult[] Execute(ITestMethod testMethod)
new TestResult { Outcome = UnitTestOutcome.Inconclusive }
];
#else
if (Thread.CurrentThread.GetApartmentState() == ApartmentState.STA)
return base.Execute(testMethod);

TestResult[]? result = null;
var thread = new Thread(() => result = base.Execute(testMethod));
thread.SetApartmentState(ApartmentState.STA);
thread.Start();
thread.Join();
return result!;
return base.Execute(testMethod);
#endif
}
}

0 comments on commit 96c18d2

Please sign in to comment.