diff --git a/Directory.Build.props b/Directory.Build.props index d98520a64..06e7f5642 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -7,8 +7,5 @@ $(MSBuildThisFileDirectory)bin\Packages\$(Configuration)\ $(DefineConstants);$(ExtraDefine) - - - - + diff --git a/LibGit2Sharp.Tests/BlobFixture.cs b/LibGit2Sharp.Tests/BlobFixture.cs index e6a5f3c57..7afbe255f 100644 --- a/LibGit2Sharp.Tests/BlobFixture.cs +++ b/LibGit2Sharp.Tests/BlobFixture.cs @@ -3,7 +3,6 @@ using System.Text; using LibGit2Sharp.Tests.TestHelpers; using Xunit; -using Xunit.Extensions; namespace LibGit2Sharp.Tests { @@ -44,6 +43,7 @@ public void CanGetBlobAsFilteredText(string autocrlf, string expectedText) } } +#if NETFRAMEWORK || NETCOREAPP2_1 [Theory] [InlineData("ascii", 4, "31 32 33 34")] [InlineData("utf-7", 4, "31 32 33 34")] @@ -83,6 +83,7 @@ public void CanGetBlobAsTextWithVariousEncodings(string encodingName, int expect Assert.Equal(expectedUtf7Chars, string.Join(" ", utf7Chars)); } } +#endif [Fact] public void CanGetBlobSize() @@ -185,7 +186,7 @@ public void CanStageAFileGeneratedFromABlobContentStream() var sb = new StringBuilder(); for (int j = 0; j < 2000; j++) { - sb.Append(((i + 1)*(j + 1)).ToString("X8")); + sb.Append(((i + 1) * (j + 1)).ToString("X8")); } File.AppendAllText(Path.Combine(repo.Info.WorkingDirectory, "small.txt"), sb.ToString()); } diff --git a/LibGit2Sharp.Tests/LibGit2Sharp.Tests.csproj b/LibGit2Sharp.Tests/LibGit2Sharp.Tests.csproj index 0525e98c8..1810df2ee 100644 --- a/LibGit2Sharp.Tests/LibGit2Sharp.Tests.csproj +++ b/LibGit2Sharp.Tests/LibGit2Sharp.Tests.csproj @@ -1,29 +1,28 @@  - net472;netcoreapp2.1 + net472;netcoreapp2.1;net5.0 - - + + - - - + + - - + + - + diff --git a/LibGit2Sharp.Tests/TestHelpers/BaseFixture.cs b/LibGit2Sharp.Tests/TestHelpers/BaseFixture.cs index 51496c2f5..8d9b9ba0c 100644 --- a/LibGit2Sharp.Tests/TestHelpers/BaseFixture.cs +++ b/LibGit2Sharp.Tests/TestHelpers/BaseFixture.cs @@ -7,7 +7,6 @@ using System.Reflection; using System.Text; using System.Text.RegularExpressions; -using LibGit2Sharp.Core; using Xunit; namespace LibGit2Sharp.Tests.TestHelpers @@ -21,7 +20,7 @@ public BaseFixture() BuildFakeConfigs(this); #if LEAKS_IDENTIFYING - LeaksContainer.Clear(); + Core.LeaksContainer.Clear(); #endif } @@ -65,7 +64,11 @@ private static void SetUpTestEnvironment() if (resourcesPath == null) { +#if NETFRAMEWORK resourcesPath = Path.Combine(Directory.GetParent(new Uri(typeof(BaseFixture).GetTypeInfo().Assembly.CodeBase).LocalPath).FullName, "Resources"); +#else + resourcesPath = Path.Combine(Directory.GetParent(typeof(BaseFixture).GetTypeInfo().Assembly.Location).FullName, "Resources"); +#endif } ResourcesDirectory = new DirectoryInfo(resourcesPath); @@ -273,11 +276,11 @@ public virtual void Dispose() GC.Collect(); GC.WaitForPendingFinalizers(); - if (LeaksContainer.TypeNames.Any()) + if (Core.LeaksContainer.TypeNames.Any()) { Assert.False(true, string.Format("Some handles of the following types haven't been properly released: {0}.{1}" + "In order to get some help fixing those leaks, uncomment the define LEAKS_TRACKING in Libgit2Object.cs{1}" - + "and run the tests locally.", string.Join(", ", LeaksContainer.TypeNames), Environment.NewLine)); + + "and run the tests locally.", string.Join(", ", Core.LeaksContainer.TypeNames), Environment.NewLine)); } #endif } diff --git a/LibGit2Sharp/LibGit2Sharp.csproj b/LibGit2Sharp/LibGit2Sharp.csproj index fe5f98ea9..ebd48acac 100644 --- a/LibGit2Sharp/LibGit2Sharp.csproj +++ b/LibGit2Sharp/LibGit2Sharp.csproj @@ -34,7 +34,7 @@ - + diff --git a/azure-pipelines/dotnet.yml b/azure-pipelines/dotnet.yml index 066d14412..3bc1eaf50 100644 --- a/azure-pipelines/dotnet.yml +++ b/azure-pipelines/dotnet.yml @@ -6,22 +6,6 @@ steps: - script: dotnet pack --no-build -c $(BuildConfiguration) /v:m /bl:"$(Build.ArtifactStagingDirectory)/build_logs/pack.binlog" displayName: dotnet pack -- task: DotNetCoreCLI@2 - displayName: dotnet test -f net46 (w/ coverage) - inputs: - command: test - arguments: --no-build -c $(BuildConfiguration) -f net46 --filter "TestCategory!=FailsInCloudTest & TestCategory!=FailsWhileInstrumented" -v n /p:CollectCoverage=true - testRunTitle: net46-$(Agent.JobName) - condition: and(succeeded(), eq(variables['Agent.OS'], 'Windows_NT')) - -- task: DotNetCoreCLI@2 - displayName: dotnet test -f net46 (w/o coverage) - inputs: - command: test - arguments: --no-build -c $(BuildConfiguration) -f net46 --filter "TestCategory!=FailsInCloudTest & TestCategory=FailsWhileInstrumented" -v n - testRunTitle: net46-$(Agent.JobName)-nocoverage - condition: and(succeeded(), eq(variables['Agent.OS'], 'Windows_NT')) - - task: DotNetCoreCLI@2 displayName: dotnet test -f net472 (w/ coverage) inputs: @@ -45,6 +29,13 @@ steps: arguments: --no-build -c $(BuildConfiguration) -f netcoreapp2.1 --filter "TestCategory!=FailsInCloudTest" -v n /p:CollectCoverage=true testRunTitle: netcoreapp2.1-$(Agent.JobName) +- task: DotNetCoreCLI@2 + displayName: dotnet test -f net5.0 + inputs: + command: test + arguments: --no-build -c $(BuildConfiguration) -f net5.0 --filter "TestCategory!=FailsInCloudTest" -v n /p:CollectCoverage=true + testRunTitle: net5.0-$(Agent.JobName) + - task: PowerShell@2 inputs: filePath: azure-pipelines/artifacts/_pipelines.ps1 diff --git a/global.json b/global.json index 05d0ae3d2..5ecd5ee6e 100644 --- a/global.json +++ b/global.json @@ -1,5 +1,5 @@ { "sdk": { - "version": "3.1.201" + "version": "5.0.301" } }