-
Notifications
You must be signed in to change notification settings - Fork 120
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix net462 tests and some async improvements #756
Changes from all commits
334667a
31233e9
1a36523
79ce7b5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,22 @@ | ||
using System; | ||
using System.IO; | ||
using System.Reflection; | ||
using Octopus.Client.Model; | ||
|
||
namespace Octopus.Client.E2ETests | ||
{ | ||
internal static class AssemblyExtensions | ||
{ | ||
public static string FullLocalPath(this Assembly assembly) | ||
{ | ||
var codeBase = assembly.CodeBase; | ||
#if NETFRAMEWORK | ||
var codeBase = assembly.CodeBase ?? throw new NotSupportedException($"Cannot get codebase for assembly {assembly}"); | ||
#else | ||
var codeBase = assembly.Location; | ||
#endif | ||
var uri = new UriBuilder(codeBase); | ||
var root = Uri.UnescapeDataString(uri.Path); | ||
root = root.Replace('/',Path.DirectorySeparatorChar); | ||
root = root.Replace('/', Path.DirectorySeparatorChar); | ||
return root; | ||
} | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,9 +25,10 @@ | |
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets> | ||
</PackageReference> | ||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.3.0" /> | ||
<PackageReference Include="NSubstitute" Version="4.3.0" /> | ||
<PackageReference Include="NUnit" Version="3.8.1" /> | ||
<PackageReference Include="NUnit3TestAdapter" Version="3.8.0" /> | ||
<PackageReference Include="NSubstitute" Version="4.4.0" /> | ||
<PackageReference Include="NUnit" Version="3.13.3" /> | ||
<PackageReference Include="NUnit3TestAdapter" Version="4.5.0" /> | ||
<PackageReference Include="System.IO.Compression" Version="4.3.0" /> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Was the dependency on There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, the newer version of |
||
<PackageReference Include="TeamCity.VSTest.TestAdapter" Version="1.0.15" /> | ||
<PackageReference Include="FluentAssertions" Version="4.15.0" /> | ||
</ItemGroup> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,15 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<RuleSet Name="Project Rules" Description="Rule overrides for gradual enablement of nullable reference types." ToolsVersion="10.0"> | ||
<Rules AnalyzerId="Microsoft.CodeAnalysis.CSharp" RuleNamespace="Microsoft.CodeAnalysis.CSharp"> | ||
<Rule Id="CS0618" Action="None"/> <!-- Use of obsolete symbol --> | ||
<Rule Id="CS0618" Action="None"/> <!-- Use of obsolete symbol --> | ||
<Rule Id="CS4014" Action="Error"/> <!-- Because this call is not awaited, execution of the current method continues before the call is completed. --> | ||
</Rules> | ||
<Rules AnalyzerId="Microsoft.CodeAnalysis.NetAnalyzers" RuleNamespace="Microsoft.CodeAnalysis.NetAnalyzers"> | ||
<Rule Id="CA1849" Action="Error"/> <!-- Call async methods when in an async method. --> | ||
<Rule Id="CA2012" Action="Error"/> <!-- Use ValueTasks correctly --> | ||
<Rule Id="CA2016" Action="Error"/> <!-- Forward the CancellationToken parameter to methods that take one --> | ||
</Rules> | ||
<Rules AnalyzerId="AsyncFixer" RuleNamespace="AsyncFixer"> | ||
<Rule Id="AsyncFixer01" Action="None"/> <!-- The method '...' does not need to use async/await --> | ||
</Rules> | ||
</RuleSet> |
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we just use
Assembly.Location
for both frameworks?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably, but not definitely.
Microsoft's documentation contains this:
Out of caution, I chose to leave the code untouched for NETFRAMEWORK.