Skip to content

Commit 6f9d4e2

Browse files
Fixing build
1 parent 9aa4d74 commit 6f9d4e2

14 files changed

+232
-25
lines changed

.github/workflows/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Pure.DI check
1+
name: CSharpInteractive check
22

33
on: [ push, pull_request ]
44

CSharpInteractive.HostApi/DotNetCommands.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3446,7 +3446,7 @@ public IStartInfo GetStartInfo(IHost host)
34463446
}
34473447

34483448
/// <summary>
3449-
/// Signs all the NuGet packages matching the first argument with a certificate.
3449+
/// Signs the NuGet packages with a certificate.
34503450
/// <p>
34513451
/// This command signs all the packages matching the first argument with a certificate. The certificate with the private key can be obtained from a file or from a certificate installed in a certificate store by providing a subject name or a SHA-1 fingerprint. This command requires a certificate root store that is valid for both code signing and timestamping. Also, this command may not be supported on some combinations of operating system and .NET SDK.
34523452
/// </p>
@@ -3552,7 +3552,7 @@ public IStartInfo GetStartInfo(IHost host)
35523552
}
35533553

35543554
/// <inheritdoc/>
3555-
public override string ToString() => (ExecutablePath == string.Empty ? "dotnet" : Path.GetFileNameWithoutExtension(ExecutablePath)).GetShortName("Signs all the NuGet packages matching the first argument with a certificate.", ShortName, new [] {"nuget", "sign"}.Concat(Packages).ToArray());
3555+
public override string ToString() => (ExecutablePath == string.Empty ? "dotnet" : Path.GetFileNameWithoutExtension(ExecutablePath)).GetShortName("Signs the NuGet packages with a certificate.", ShortName, new [] {"nuget", "sign"}.Concat(Packages).ToArray());
35563556
}
35573557

35583558
/// <summary>
@@ -3723,7 +3723,7 @@ public IStartInfo GetStartInfo(IHost host)
37233723
/// using HostApi;
37243724
///
37253725
/// new DotNetNuGetConfigSet()
3726-
/// .WithConfigFile("nuget.config")
3726+
/// .WithConfigFile(configFile)
37273727
/// .WithConfigKey("repositoryPath")
37283728
/// .WithConfigValue("MyValue")
37293729
/// .Run().EnsureSuccess();

CSharpInteractive.HostApi/DotNetCommands.tt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -871,7 +871,7 @@ using Internal;
871871
),
872872
new(
873873
"DotNetNuGetSign",
874-
"Signs all the NuGet packages matching the first argument with a certificate.",
874+
"Signs the NuGet packages with a certificate.",
875875
[
876876
paraStart,
877877
"This command signs all the packages matching the first argument with a certificate. The certificate with the private key can be obtained from a file or from a certificate installed in a certificate store by providing a subject name or a SHA-1 fingerprint. This command requires a certificate root store that is valid for both code signing and timestamping. Also, this command may not be supported on some combinations of operating system and .NET SDK.",

CSharpInteractive.Tests/README_TEMPLATE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -874,7 +874,7 @@ new DotNetNuGetConfigPaths()
874874
using HostApi;
875875

876876
new DotNetNuGetConfigSet()
877-
.WithConfigFile("nuget.config")
877+
.WithConfigFile(configFile)
878878
.WithConfigKey("repositoryPath")
879879
.WithConfigValue("MyValue")
880880
.Run().EnsureSuccess();

CSharpInteractive.Tests/UsageScenarios/BaseScenario.cs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
// ReSharper disable MemberCanBeProtected.Global
22

3+
// ReSharper disable MemberCanBeMadeStatic.Global
34
namespace CSharpInteractive.Tests.UsageScenarios;
45

56
using System.Collections;
67
using System.Diagnostics.CodeAnalysis;
78
using System.Text;
89
using CSharpInteractive;
10+
using NuGet.Versioning;
911
using Environment = System.Environment;
1012

1113
[SuppressMessage("Usage", "CA1816:Dispose methods should call SuppressFinalize")]
@@ -31,6 +33,25 @@ public BaseScenario(ITestOutputHelper output)
3133

3234
public int? ExpectedExitCode { get; set; } = 0;
3335

36+
[SuppressMessage("Performance", "CA1822:Пометьте члены как статические")]
37+
public bool HasSdk(string sdkVersion)
38+
{
39+
var versions = new List<NuGetVersion>();
40+
new DotNetSdkCheck()
41+
.Run(output =>
42+
{
43+
if (output.Line.Split(' ', StringSplitOptions.RemoveEmptyEntries) is ["Microsoft.NETCore.App", var versionStr, ..]
44+
&& NuGetVersion.TryParse(versionStr, out var version))
45+
{
46+
versions.Add(version);
47+
}
48+
})
49+
.EnsureSuccess();
50+
51+
var sdkVersionValue = NuGetVersion.Parse(sdkVersion);
52+
return versions.Any(i => i >= sdkVersionValue);
53+
}
54+
3455
// ReSharper disable once MemberCanBeProtected.Global
3556
public IHost Host => this;
3657

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
using HostApi;
22

33
new DotNetNuGetConfigSet()
4-
.WithConfigFile("nuget.config")
4+
.WithConfigFile(configFile)
55
.WithConfigKey("repositoryPath")
66
.WithConfigValue("MyValue")
77
.Run().EnsureSuccess();

CSharpInteractive.Tests/UsageScenarios/DotNetNuGetConfigGetScenario.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,17 @@
55
namespace CSharpInteractive.Tests.UsageScenarios;
66

77
using System.Diagnostics.CodeAnalysis;
8+
using NuGet.Versioning;
89

910
[CollectionDefinition("Integration", DisableParallelization = true)]
1011
[Trait("Integration", "True")]
1112
[SuppressMessage("Performance", "CA1861:Avoid constant arrays as arguments")]
1213
public class DotNetNuGetConfigSetScenario(ITestOutputHelper output) : BaseScenario(output)
1314
{
14-
[Fact]
15+
[SkippableFact]
1516
public void Run()
1617
{
18+
Skip.IfNot(HasSdk("8.0.10"));
1719
var configFile = Path.GetFullPath("nuget.config");
1820
File.WriteAllText(configFile, "<configuration></configuration>");
1921

CSharpInteractive.Tests/UsageScenarios/DotNetNuGetConfigPathsScenario.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,10 @@ namespace CSharpInteractive.Tests.UsageScenarios;
1111
[SuppressMessage("Performance", "CA1861:Avoid constant arrays as arguments")]
1212
public class DotNetNuGetConfigPathsScenario(ITestOutputHelper output) : BaseScenario(output)
1313
{
14-
[Fact]
14+
[SkippableFact]
1515
public void Run()
1616
{
17+
Skip.IfNot(HasSdk("8.0.10"));
1718
var configFile = Path.GetFullPath("nuget.config");
1819
File.WriteAllText(configFile, "<configuration></configuration>");
1920

CSharpInteractive.Tests/UsageScenarios/DotNetNuGetConfigSetScenario.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,10 @@ namespace CSharpInteractive.Tests.UsageScenarios;
1111
[SuppressMessage("Performance", "CA1861:Avoid constant arrays as arguments")]
1212
public class DotNetNuGetConfigGetScenario(ITestOutputHelper output) : BaseScenario(output)
1313
{
14-
[Fact]
14+
[SkippableFact]
1515
public void Run()
1616
{
17+
Skip.IfNot(HasSdk("8.0.10"));
1718
var configFile = Path.GetFullPath("nuget.config");
1819
File.WriteAllText(configFile, "<configuration></configuration>");
1920

CSharpInteractive.Tests/UsageScenarios/DotNetNuGetConfigUnsetScenario.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,15 @@ namespace CSharpInteractive.Tests.UsageScenarios;
1111
[SuppressMessage("Performance", "CA1861:Avoid constant arrays as arguments")]
1212
public class DotNetNuGetConfigUnsetScenario(ITestOutputHelper output) : BaseScenario(output)
1313
{
14-
[Fact]
14+
[SkippableFact]
1515
public void Run()
1616
{
17+
Skip.IfNot(HasSdk("8.0.10"));
1718
ExpectedExitCode = default;
18-
File.WriteAllText("nuget.config", "<configuration></configuration>");
19+
var configFile = Path.GetFullPath("nuget.config");
20+
File.WriteAllText(configFile, "<configuration></configuration>");
1921
new DotNetNuGetConfigSet()
20-
.WithConfigFile("nuget.config")
22+
.WithConfigFile(configFile)
2123
.WithConfigKey("repositoryPath")
2224
.WithConfigValue("MyValue")
2325
.Run().EnsureSuccess();

0 commit comments

Comments
 (0)