Permalink
Browse files

Fix failing unit tests being run with MTA thread.

Setting the ApartmentState to STA in app.config is no longer supported by NUnit 2.6.1. Instead the RequiresSTA attribute needs to be used.
  • Loading branch information...
1 parent d715490 commit ec6ad9e42ef8876079c54e14669997381267e794 @mrward mrward committed Aug 12, 2012
Showing with 63 additions and 136 deletions.
  1. +0 −2 src/AddIns/BackendBindings/CSharpBinding/Tests/CSharpBinding.Tests.csproj
  2. +5 −0 src/AddIns/BackendBindings/CSharpBinding/Tests/Properties/AssemblyInfo.cs
  3. +0 −13 src/AddIns/BackendBindings/CSharpBinding/Tests/app.config
  4. +5 −0 src/AddIns/BackendBindings/Python/PythonBinding/Test/AssemblyInfo.cs
  5. +0 −1 src/AddIns/BackendBindings/Python/PythonBinding/Test/PythonBinding.Tests.csproj
  6. +0 −14 src/AddIns/BackendBindings/Python/PythonBinding/Test/app.config
  7. +5 −0 src/AddIns/BackendBindings/Ruby/RubyBinding/Test/AssemblyInfo.cs
  8. +0 −1 src/AddIns/BackendBindings/Ruby/RubyBinding/Test/RubyBinding.Tests.csproj
  9. +0 −14 src/AddIns/BackendBindings/Ruby/RubyBinding/Test/app.config
  10. +20 −0 src/AddIns/BackendBindings/VBNetBinding/Test/Configuration/AssemblyInfo.cs
  11. +5 −1 src/AddIns/BackendBindings/VBNetBinding/Test/VBNetBinding.Tests.csproj
  12. +0 −13 src/AddIns/BackendBindings/VBNetBinding/Test/app.config
  13. +5 −0 src/AddIns/BackendBindings/WixBinding/Test/AssemblyInfo.cs
  14. +0 −1 src/AddIns/BackendBindings/WixBinding/Test/WixBinding.Tests.csproj
  15. +0 −15 src/AddIns/BackendBindings/WixBinding/Test/app.config
  16. +5 −0 src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Tests/AssemblyInfo.cs
  17. +0 −1 src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Tests/WpfDesign.Tests.csproj
  18. +0 −15 src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Tests/app.config
  19. +4 −0 src/AddIns/DisplayBindings/XmlEditor/Test/AssemblyInfo.cs
  20. +0 −1 src/AddIns/DisplayBindings/XmlEditor/Test/XmlEditor.Tests.csproj
  21. +0 −13 src/AddIns/DisplayBindings/XmlEditor/Test/app.config
  22. +0 −1 src/AddIns/Misc/PackageManagement/Test/PackageManagement.Tests.csproj
  23. +4 −0 src/AddIns/Misc/PackageManagement/Test/Properties/AssemblyInfo.cs
  24. +0 −14 src/AddIns/Misc/PackageManagement/Test/app.config
  25. +0 −1 src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit.Tests/ICSharpCode.AvalonEdit.Tests.csproj
  26. +5 −0 src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit.Tests/Properties/AssemblyInfo.cs
  27. +0 −15 src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit.Tests/app.config
@@ -68,8 +68,6 @@
<Compile Include="MockTextEditor.cs" />
<Compile Include="OverrideCompletionTests.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
- <None Include="app.config">
- </None>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\..\Libraries\AvalonEdit\ICSharpCode.AvalonEdit\ICSharpCode.AvalonEdit.csproj">
@@ -7,6 +7,8 @@
using System.Reflection;
using System.Runtime.InteropServices;
+using NUnit.Framework;
+
#endregion
// General Information about an assembly is controlled through the following
@@ -32,3 +34,6 @@
// You can specify all the values or you can use the default the Revision and
// Build Numbers by using the '*' as shown below:
[assembly: AssemblyVersion("1.0.*")]
+
+// Run unit tests on STA thread.
+[assembly: RequiresSTA]
@@ -1,13 +0,0 @@
-<configuration>
- <configSections>
- <sectionGroup name="NUnit">
- <section name="TestRunner" type="System.Configuration.NameValueSectionHandler" />
- </sectionGroup>
- </configSections>
- <NUnit>
- <TestRunner>
- <!-- Valid values are STA,MTA. Others ignored. -->
- <add key="ApartmentState" value="STA" />
- </TestRunner>
- </NUnit>
-</configuration>
@@ -5,6 +5,8 @@
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
+using NUnit.Framework;
+
// Information about this assembly is defined by the following
// attributes.
//
@@ -32,3 +34,6 @@
// numbers with the '*' character (the default):
[assembly: AssemblyVersion("0.3")]
+
+// Run unit tests on STA thread.
+[assembly: RequiresSTA]
@@ -437,7 +437,6 @@
<EmbeddedResource Include="..\Project\PythonBinding.addin">
<Link>PythonBinding.addin</Link>
</EmbeddedResource>
- <None Include="app.config" />
<Compile Include="Parsing\AddInvalidSourceSpanToErrorSinkTestFixture.cs" />
<Compile Include="Utils\PythonBindingAddInFile.cs" />
<Compile Include="Utils\PythonCompletionItemsHelper.cs" />
@@ -1,14 +0,0 @@
-<configuration>
- <configSections>
- <sectionGroup name="NUnit">
- <section name="TestRunner"
- type="System.Configuration.NameValueSectionHandler" />
- </sectionGroup>
- </configSections>
- <NUnit>
- <TestRunner>
- <!-- Valid values are STA,MTA. Others ignored. -->
- <add key="ApartmentState" value="STA" />
- </TestRunner>
- </NUnit>
-</configuration>
@@ -7,6 +7,8 @@
using System.Reflection;
using System.Runtime.InteropServices;
+using NUnit.Framework;
+
#endregion
// General Information about an assembly is controlled through the following
@@ -32,3 +34,6 @@
// You can specify all the values or you can use the default the Revision and
// Build Numbers by using the '*' as shown below:
[assembly: AssemblyVersion("1.0.*")]
+
+// Run unit tests on STA thread.
+[assembly: RequiresSTA]
@@ -318,7 +318,6 @@
<EmbeddedResource Include="..\Project\RubyBinding.addin">
<Link>RubyBinding.addin</Link>
</EmbeddedResource>
- <None Include="app.config" />
<EmbeddedResource Include="Designer\App.ico" />
<EmbeddedResource Include="Strings.resx" />
</ItemGroup>
@@ -1,14 +0,0 @@
-<configuration>
- <configSections>
- <sectionGroup name="NUnit">
- <section name="TestRunner"
- type="System.Configuration.NameValueSectionHandler" />
- </sectionGroup>
- </configSections>
- <NUnit>
- <TestRunner>
- <!-- Valid values are STA,MTA. Others ignored. -->
- <add key="ApartmentState" value="STA" />
- </TestRunner>
- </NUnit>
-</configuration>
@@ -0,0 +1,20 @@
+// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
+// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
+
+using System.Reflection;
+using NUnit.Framework;
+
+// Information about this assembly is defined by the following
+// attributes.
+//
+// change them to the information which is associated with the assembly
+// you compile.
+
+[assembly: AssemblyTitle("VBNetBinding.Tests")]
+[assembly: AssemblyDescription("VB.NET language binding for #develop")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Run unit tests on STA thread.
+[assembly: RequiresSTA]
@@ -57,9 +57,14 @@
</Reference>
</ItemGroup>
<ItemGroup>
+ <Compile Include="..\..\..\..\Main\GlobalAssemblyInfo.cs">
+ <Link>Configuration\GlobalAssemblyInfo.cs</Link>
+ </Compile>
+ <Compile Include="Configuration\AssemblyInfo.cs" />
<Compile Include="LanguageUtilsTests.cs" />
<Compile Include="MockTextEditor.cs" />
<Compile Include="TextEditorBasedTests.cs" />
+ <Folder Include="Configuration" />
<ProjectReference Include="..\..\..\..\Libraries\AvalonEdit\ICSharpCode.AvalonEdit\ICSharpCode.AvalonEdit.csproj">
<Project>{6C55B776-26D4-4DB3-A6AB-87E783B2F3D1}</Project>
<Name>ICSharpCode.AvalonEdit</Name>
@@ -86,7 +91,6 @@
<Compile Include="FormattingStrategy\EndSubTests.cs" />
<Compile Include="FormattingStrategy\IndentationTests.cs" />
<Compile Include="FormattingStrategy\InterfaceTests.cs" />
- <None Include="app.config" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" />
</Project>
@@ -1,13 +0,0 @@
-<configuration>
- <configSections>
- <sectionGroup name="NUnit">
- <section name="TestRunner" type="System.Configuration.NameValueSectionHandler" />
- </sectionGroup>
- </configSections>
- <NUnit>
- <TestRunner>
- <!-- Valid values are STA,MTA. Others ignored. -->
- <add key="ApartmentState" value="STA" />
- </TestRunner>
- </NUnit>
-</configuration>
@@ -5,6 +5,8 @@
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
+using NUnit.Framework;
+
// Information about this assembly is defined by the following
// attributes.
//
@@ -32,3 +34,6 @@
// numbers with the '*' character (the default):
[assembly: AssemblyVersion("2.0.0.1")]
+
+// Run unit tests on STA thread.
+[assembly: RequiresSTA]
@@ -301,7 +301,6 @@
<Compile Include="Diff\SameFileReferencedTwiceTestFixture.cs" />
<Compile Include="Project\CanCompileTests.cs" />
<Compile Include="DirectoryImport\AddDirectoryWithInvalidIdCharsTestFixture.cs" />
- <None Include="app.config" />
</ItemGroup>
<ItemGroup>
<Folder Include="Utils\Tests" />
@@ -1,15 +0,0 @@
-<?xml version="1.0" encoding="utf-8" ?>
-<configuration>
- <configSections>
- <sectionGroup name="NUnit">
- <section name="TestRunner"
- type="System.Configuration.NameValueSectionHandler" />
- </sectionGroup>
- </configSections>
- <NUnit>
- <TestRunner>
- <!-- Valid values are STA,MTA. Others ignored. -->
- <add key="ApartmentState" value="STA" />
- </TestRunner>
- </NUnit>
-</configuration>
@@ -5,6 +5,8 @@
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
+using NUnit.Framework;
+
// Information about this assembly is defined by the following
// attributes.
//
@@ -16,3 +18,6 @@
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
+
+// Run unit tests on STA thread.
+[assembly: RequiresSTA]
@@ -75,7 +75,6 @@
<Compile Include="XamlDom\TestHelper.cs" />
<Compile Include="XamlDom\WhitespaceTests.cs" />
<Compile Include="XamlDom\XamlTypeFinderTests.cs" />
- <None Include="app.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\..\..\Main\ICSharpCode.SharpDevelop.Widgets\Project\ICSharpCode.SharpDevelop.Widgets.csproj">
@@ -1,15 +0,0 @@
-<?xml version="1.0"?>
-<configuration>
- <configSections>
- <sectionGroup name="NUnit">
- <section name="TestRunner"
- type="System.Configuration.NameValueSectionHandler" />
- </sectionGroup>
- </configSections>
- <NUnit>
- <TestRunner>
- <!-- Valid values are STA,MTA. Others ignored. -->
- <add key="ApartmentState" value="STA" />
- </TestRunner>
- </NUnit>
-</configuration>
@@ -3,6 +3,7 @@
using System.Reflection;
using System.Runtime.CompilerServices;
+using NUnit.Framework;
// Information about this assembly is defined by the following
// attributes.
@@ -33,3 +34,6 @@
// This is not required, if you don't want signing let these attributes like they're.
[assembly: AssemblyDelaySign(false)]
[assembly: AssemblyKeyFile("")]
+
+// Run unit tests on STA thread.
+[assembly: RequiresSTA]
@@ -335,7 +335,6 @@
<Compile Include="Tree\InsertElementBeforeTestFixture.cs" />
<Compile Include="Tree\AddElementsToTreeControlTestFixture.cs" />
<Compile Include="Tree\InsertElementAfterTestFixture.cs" />
- <None Include="app.config" />
</ItemGroup>
<ItemGroup>
<Folder Include="Completion" />
@@ -1,13 +0,0 @@
-<configuration>
- <configSections>
- <sectionGroup name="NUnit">
- <section name="TestRunner" type="System.Configuration.NameValueSectionHandler" />
- </sectionGroup>
- </configSections>
- <NUnit>
- <TestRunner>
- <!-- Valid values are STA,MTA. Others ignored. -->
- <add key="ApartmentState" value="STA" />
- </TestRunner>
- </NUnit>
-</configuration>
@@ -371,7 +371,6 @@
<Link>SharpDevelop.exe</Link>
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
- <None Include="app.config" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" />
</Project>
@@ -2,6 +2,7 @@
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System.Reflection;
+using NUnit.Framework;
// Information about this assembly is defined by the following
// attributes.
@@ -14,3 +15,6 @@
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
+
+// Run unit tests on STA thread.
+[assembly: RequiresSTA]
@@ -1,14 +0,0 @@
-<configuration>
- <configSections>
- <sectionGroup name="NUnit">
- <section name="TestRunner"
- type="System.Configuration.NameValueSectionHandler" />
- </sectionGroup>
- </configSections>
- <NUnit>
- <TestRunner>
- <!-- Valid values are STA,MTA. Others ignored. -->
- <add key="ApartmentState" value="STA" />
- </TestRunner>
- </NUnit>
-</configuration>
@@ -94,7 +94,6 @@
<Compile Include="WeakReferenceTests.cs" />
<Compile Include="XmlParser\ParserTests.cs" />
<Compile Include="XmlParser\TextReplacementTests.cs" />
- <None Include="app.config" />
<None Include="XmlParser\W3C.zip">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
@@ -7,6 +7,8 @@
using System.Reflection;
using System.Runtime.InteropServices;
+using NUnit.Framework;
+
#endregion
// General Information about an assembly is controlled through the following
@@ -31,3 +33,6 @@
// You can specify all the values or you can use the default the Revision and
// Build Numbers by using the '*' as shown below:
[assembly: AssemblyVersion("1.0.*")]
+
+// Run unit tests on STA thread.
+[assembly: RequiresSTA]
@@ -1,15 +0,0 @@
-<?xml version="1.0" encoding="utf-8" ?>
-<configuration>
- <configSections>
- <sectionGroup name="NUnit">
- <section name="TestRunner"
- type="System.Configuration.NameValueSectionHandler" />
- </sectionGroup>
- </configSections>
- <NUnit>
- <TestRunner>
- <!-- Valid values are STA,MTA. Others ignored. -->
- <add key="ApartmentState" value="STA" />
- </TestRunner>
- </NUnit>
-</configuration>

0 comments on commit ec6ad9e

Please sign in to comment.