Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono-addins.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLluis Sanchez <llsan@microsoft.com>2022-09-16 11:35:14 +0300
committerGitHub <noreply@github.com>2022-09-16 11:35:14 +0300
commitc35de362f770a4d8f613e12fc96a1d37584b2d56 (patch)
treeb84564e281d15fea6fd398836f3449f8d82adc99
parent10d055187ecf7df8145b426b3f9122a73b358b60 (diff)
parenta268ef6fee28e4478d52255222ddb468e698a469 (diff)
Merge pull request #190 from mono/dev/lluis/fix-tests
Fix unit tests and run them in CI
-rw-r--r--.gitignore1
-rw-r--r--Mono.Addins/Mono.Addins.csproj1
-rw-r--r--Test/CommandExtension/CommandExtension.csproj2
-rw-r--r--Test/FileContentExtension/FileContentExtension.csproj2
-rw-r--r--Test/FileExtender/FileExtender.csproj2
-rw-r--r--Test/HelloWorldExtension/HelloWorldExtension.csproj2
-rw-r--r--Test/MultiAssemblyAddin/MultiAssemblyAddin.csproj2
-rw-r--r--Test/MultiAssemblyAddin/OptionalModule/OptionalModule.csproj2
-rw-r--r--Test/MultiAssemblyAddin/SecondAssembly/SecondAssembly.csproj2
-rw-r--r--Test/SystemInfoExtension/SystemInfoExtension.csproj2
-rw-r--r--Test/UnitTests/TestBase.cs22
-rw-r--r--Test/UnitTests/TestSetupService.cs2
-rw-r--r--Test/UnitTests/UnitTests.csproj18
-rw-r--r--Test/UnitTests/Util.cs2
-rw-r--r--Test/UnitTests/test.addins4
-rw-r--r--azure-pipelines.yml21
16 files changed, 40 insertions, 47 deletions
diff --git a/.gitignore b/.gitignore
index acd779d..a5d8f58 100644
--- a/.gitignore
+++ b/.gitignore
@@ -10,6 +10,7 @@ obj
Test/UnitTests/bin
Test/UnitTests/obj
Test/lib
+Test/tmp
packages
# Ide stuff
diff --git a/Mono.Addins/Mono.Addins.csproj b/Mono.Addins/Mono.Addins.csproj
index cfd7346..9bdd5d0 100644
--- a/Mono.Addins/Mono.Addins.csproj
+++ b/Mono.Addins/Mono.Addins.csproj
@@ -15,6 +15,7 @@
<NoWarn>1574;1591</NoWarn>
<ConsolePause>False</ConsolePause>
<OutputPath>..\bin</OutputPath>
+ <LangVersion>9.0</LangVersion>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1" PrivateAssets="All"/>
diff --git a/Test/CommandExtension/CommandExtension.csproj b/Test/CommandExtension/CommandExtension.csproj
index b05b551..bbfb9ef 100644
--- a/Test/CommandExtension/CommandExtension.csproj
+++ b/Test/CommandExtension/CommandExtension.csproj
@@ -11,6 +11,8 @@
<SchemaVersion>2.0</SchemaVersion>
<RootNamespace>CommandExtension</RootNamespace>
<AssemblyVersion>0.0.0.0</AssemblyVersion>
+ <TargetFrameworks>$(DotNetCoreTarget)</TargetFrameworks>
+ <AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>True</DebugSymbols>
diff --git a/Test/FileContentExtension/FileContentExtension.csproj b/Test/FileContentExtension/FileContentExtension.csproj
index bd9e1a6..355eb9c 100644
--- a/Test/FileContentExtension/FileContentExtension.csproj
+++ b/Test/FileContentExtension/FileContentExtension.csproj
@@ -11,6 +11,8 @@
<SchemaVersion>2.0</SchemaVersion>
<RootNamespace>FileContentExtension</RootNamespace>
<AssemblyVersion>0.0.0.0</AssemblyVersion>
+ <TargetFrameworks>$(DotNetCoreTarget)</TargetFrameworks>
+ <AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>True</DebugSymbols>
diff --git a/Test/FileExtender/FileExtender.csproj b/Test/FileExtender/FileExtender.csproj
index b2d6155..c40029f 100644
--- a/Test/FileExtender/FileExtender.csproj
+++ b/Test/FileExtender/FileExtender.csproj
@@ -11,6 +11,8 @@
<SchemaVersion>2.0</SchemaVersion>
<RootNamespace>FileExtender</RootNamespace>
<AssemblyVersion>0.0.0.0</AssemblyVersion>
+ <TargetFrameworks>$(DotNetCoreTarget)</TargetFrameworks>
+ <AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>True</DebugSymbols>
diff --git a/Test/HelloWorldExtension/HelloWorldExtension.csproj b/Test/HelloWorldExtension/HelloWorldExtension.csproj
index fa8173d..726fc88 100644
--- a/Test/HelloWorldExtension/HelloWorldExtension.csproj
+++ b/Test/HelloWorldExtension/HelloWorldExtension.csproj
@@ -11,6 +11,8 @@
<SchemaVersion>2.0</SchemaVersion>
<RootNamespace>HelloWorldExtension</RootNamespace>
<AssemblyVersion>0.0.0.0</AssemblyVersion>
+ <TargetFrameworks>$(DotNetCoreTarget)</TargetFrameworks>
+ <AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>True</DebugSymbols>
diff --git a/Test/MultiAssemblyAddin/MultiAssemblyAddin.csproj b/Test/MultiAssemblyAddin/MultiAssemblyAddin.csproj
index ca110a9..ba75db4 100644
--- a/Test/MultiAssemblyAddin/MultiAssemblyAddin.csproj
+++ b/Test/MultiAssemblyAddin/MultiAssemblyAddin.csproj
@@ -11,6 +11,8 @@
<RootNamespace>MultiAssemblyAddin</RootNamespace>
<AssemblyName>MultiAssemblyAddin</AssemblyName>
<AssemblyVersion>0.0.0.0</AssemblyVersion>
+ <TargetFrameworks>$(DotNetCoreTarget)</TargetFrameworks>
+ <AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>True</DebugSymbols>
diff --git a/Test/MultiAssemblyAddin/OptionalModule/OptionalModule.csproj b/Test/MultiAssemblyAddin/OptionalModule/OptionalModule.csproj
index 545018f..5ff431d 100644
--- a/Test/MultiAssemblyAddin/OptionalModule/OptionalModule.csproj
+++ b/Test/MultiAssemblyAddin/OptionalModule/OptionalModule.csproj
@@ -11,6 +11,8 @@
<RootNamespace>OptionalModule</RootNamespace>
<AssemblyName>OptionalModule</AssemblyName>
<AssemblyVersion>0.0.0.0</AssemblyVersion>
+ <TargetFrameworks>$(DotNetCoreTarget)</TargetFrameworks>
+ <AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>True</DebugSymbols>
diff --git a/Test/MultiAssemblyAddin/SecondAssembly/SecondAssembly.csproj b/Test/MultiAssemblyAddin/SecondAssembly/SecondAssembly.csproj
index 31422ce..4c32a31 100644
--- a/Test/MultiAssemblyAddin/SecondAssembly/SecondAssembly.csproj
+++ b/Test/MultiAssemblyAddin/SecondAssembly/SecondAssembly.csproj
@@ -11,6 +11,8 @@
<RootNamespace>SecondAssembly</RootNamespace>
<AssemblyName>SecondAssembly</AssemblyName>
<AssemblyVersion>0.0.0.0</AssemblyVersion>
+ <TargetFrameworks>$(DotNetCoreTarget)</TargetFrameworks>
+ <AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>True</DebugSymbols>
diff --git a/Test/SystemInfoExtension/SystemInfoExtension.csproj b/Test/SystemInfoExtension/SystemInfoExtension.csproj
index b5c47f3..9231588 100644
--- a/Test/SystemInfoExtension/SystemInfoExtension.csproj
+++ b/Test/SystemInfoExtension/SystemInfoExtension.csproj
@@ -11,6 +11,8 @@
<SchemaVersion>2.0</SchemaVersion>
<RootNamespace>SystemInfoExtension</RootNamespace>
<AssemblyVersion>0.0.0.0</AssemblyVersion>
+ <TargetFrameworks>$(DotNetCoreTarget)</TargetFrameworks>
+ <AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>True</DebugSymbols>
diff --git a/Test/UnitTests/TestBase.cs b/Test/UnitTests/TestBase.cs
index 0742fec..e015b23 100644
--- a/Test/UnitTests/TestBase.cs
+++ b/Test/UnitTests/TestBase.cs
@@ -9,8 +9,6 @@ namespace UnitTests
{
public class TestBase
{
- static bool firstRun = true;
-
public static string TempDir {
get {
string dir = new Uri (typeof(TestBase).Assembly.CodeBase).LocalPath;
@@ -25,23 +23,19 @@ namespace UnitTests
AddinManager.AddinLoaded += OnLoad;
AddinManager.AddinUnloaded += OnUnload;
- if (firstRun) {
- if (Directory.Exists (TempDir))
- Directory.Delete (TempDir, true);
- Directory.CreateDirectory (TempDir);
- }
+ if (Directory.Exists (TempDir))
+ Directory.Delete (TempDir, true);
+ Directory.CreateDirectory (TempDir);
+
+ var configDir = Path.Combine(TempDir, "config");
+ Directory.CreateDirectory(configDir);
// Provide the current assembly as startup assembly, otherwise it will pick the
// unit test runner as startup assembly
- AddinManager.AddinEngine.Initialize (GetType().Assembly, null, TempDir, null, null);
-
- if (firstRun)
- AddinManager.Registry.Update (new ConsoleProgressStatus (true));
- else
- AddinManager.Registry.ResetConfiguration ();
+ AddinManager.AddinEngine.Initialize (GetType().Assembly, null, configDir, null, null);
- firstRun = false;
+ AddinManager.Registry.Update (new ConsoleProgressStatus (true));
}
[OneTimeTearDown]
diff --git a/Test/UnitTests/TestSetupService.cs b/Test/UnitTests/TestSetupService.cs
index d83fe67..5546336 100644
--- a/Test/UnitTests/TestSetupService.cs
+++ b/Test/UnitTests/TestSetupService.cs
@@ -51,7 +51,7 @@ namespace UnitTests
{
setup = new SetupService ();
baseDir = Path.GetDirectoryName (new Uri (typeof(TestBase).Assembly.CodeBase).LocalPath);
- addinsDir = new DirectoryInfo (baseDir).Parent.Parent.Parent.FullName;
+ addinsDir = new DirectoryInfo (baseDir).Parent.Parent.Parent.Parent.FullName;
addinsDir = Path.Combine (addinsDir, "lib");
repoDir = Path.Combine (TempDir, "repo");
diff --git a/Test/UnitTests/UnitTests.csproj b/Test/UnitTests/UnitTests.csproj
index f9ff798..30badc8 100644
--- a/Test/UnitTests/UnitTests.csproj
+++ b/Test/UnitTests/UnitTests.csproj
@@ -2,25 +2,14 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\..\TargetFrameworks.props" />
<PropertyGroup>
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
- <ProductVersion>8.0.30703</ProductVersion>
- <ProjectGuid>{1CD51E61-1985-4D22-9BFA-D14C8FC61B46}</ProjectGuid>
<OutputType>Library</OutputType>
<AssemblyName>UnitTests</AssemblyName>
- <SchemaVersion>2.0</SchemaVersion>
<RootNamespace>UnitTests</RootNamespace>
<SignAssembly>True</SignAssembly>
<AssemblyOriginatorKeyFile>..\..\mono-addins.snk</AssemblyOriginatorKeyFile>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
- <DebugSymbols>True</DebugSymbols>
- <DebugType>full</DebugType>
- <Optimize>false</Optimize>
- <OutputPath>bin\Debug</OutputPath>
- <ErrorReport>prompt</ErrorReport>
- <WarningLevel>4</WarningLevel>
- <CheckForOverflowUnderflow>True</CheckForOverflowUnderflow>
+ <TargetFrameworks>net472;net6.0</TargetFrameworks>
+ <LangVersion>9.0</LangVersion>
+ <DebugType>embedded</DebugType>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
@@ -28,6 +17,7 @@
<Reference Include="System.Core" />
<PackageReference Include="NUnit" Version="3.12.0" />
<PackageReference Include="NUnit3TestAdapter" Version="3.17.0" />
+ <PackageReference Include="Microsoft.Net.Test.Sdk" Version="17.3.1" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\Mono.Addins\Mono.Addins.csproj" />
diff --git a/Test/UnitTests/Util.cs b/Test/UnitTests/Util.cs
index 9c4cecd..0187eaf 100644
--- a/Test/UnitTests/Util.cs
+++ b/Test/UnitTests/Util.cs
@@ -40,7 +40,7 @@ namespace UnitTests
public static string TestsRootDir {
get {
if (rootDir == null)
- rootDir = Path.GetFullPath (Path.Combine (Path.GetDirectoryName (typeof(Util).Assembly.Location), "..", "..", ".."));
+ rootDir = Path.GetFullPath (Path.Combine (Path.GetDirectoryName (typeof(Util).Assembly.Location), "..", "..", "..", ".."));
return rootDir;
}
}
diff --git a/Test/UnitTests/test.addins b/Test/UnitTests/test.addins
index ebd1db7..df2ae14 100644
--- a/Test/UnitTests/test.addins
+++ b/Test/UnitTests/test.addins
@@ -1,5 +1,5 @@
<Addins>
- <Directory>../../../lib</Directory>
- <Directory>../../../lib/extras</Directory>
+ <Directory>../../../../lib</Directory>
+ <Directory>../../../../lib/extras</Directory>
<Directory>SampleAddins</Directory>
</Addins>
diff --git a/azure-pipelines.yml b/azure-pipelines.yml
index 5c59ddd..0d7562c 100644
--- a/azure-pipelines.yml
+++ b/azure-pipelines.yml
@@ -1,5 +1,5 @@
pool:
- vmImage: 'macOS-10.15'
+ vmImage: 'macos-latest'
variables:
- name: BuildConfiguration
@@ -52,20 +52,11 @@ steps:
nobuild: true
workingDirectory: $(Build.SourcesDirectory)
-#- task: MSBuild@1
-# displayName: 'Test Assemblies Test\UnitTests\bin\Debug\UnitTests.dll'
-# inputs:
-# solution: 'Test/UnitTests/UnitTests.csproj'
-# platform: '$(BuildPlatform)'
-# configuration: '$(BuildConfiguration)'
-# msbuildArguments: '/t:Test'
-#
-#- task: PublishTestResults@2
-# displayName: 'Publish Test Results Test\UnitTests\TestResult.xml'
-# inputs:
-# testResultsFormat: 'NUnit'
-# testResultsFiles: 'Test/UnitTests/TestResult.xml'
-# failTaskOnFailedTests: true
+- task: DotNetCoreCLI@2
+ displayName: Test
+ inputs:
+ command: 'test'
+ workingDirectory: '$(Build.SourcesDirectory)/Test/UnitTests'
- task: Bash@3
displayName: 'Generate package file list'