Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,16 @@ jobs:
dotnet-version: |
8.0.x
9.0.x
10.0.x
include-prerelease: true
- name: Install dotnet-script
run: dotnet tool install dotnet-script --global

- name: Run build script
run: dotnet-script build/Build.csx

build-mac:
runs-on: macos-13
build-mac-arm:
runs-on: macos-26

steps:
- uses: actions/checkout@v3
Expand All @@ -32,6 +33,7 @@ jobs:
dotnet-version: |
8.0.x
9.0.x
10.0.x
include-prerelease: true
- name: Install dotnet-script
run: dotnet tool install dotnet-script --global
Expand All @@ -50,6 +52,7 @@ jobs:
dotnet-version: |
8.0.x
9.0.x
10.0.x
include-prerelease: true
- name: Install dotnet-script
run: dotnet tool install dotnet-script --global
Expand Down
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Run C# scripts from the .NET CLI, define NuGet packages inline and edit/debug th

### Prerequisites

The only thing we need to install is [.NET 8.0 or .NET 9.0 SDK](https://dotnet.microsoft.com/en-us/download/dotnet).
The only thing we need to install is [.NET 8.0, .NET 9.0 or .NET10 SDK](https://dotnet.microsoft.com/en-us/download/dotnet).

[Note](https://learn.microsoft.com/en-us/dotnet/core/install/linux-scripted-manual#manual-install):
> If you install the .NET SDK to a non-default location, you need to set the environment variable `DOTNET_ROOT` to the directory that contains the dotnet executable
Expand Down Expand Up @@ -267,6 +267,12 @@ The executable you can run directly independent of dotnet install, while the DLL
dotnet script exec {path_to_dll} -- arg1 arg2
```

### Assembly Load Context
Starting with version 2.0.0, `Dotnet-Script` will use an isolated load context for loading assemblies. This means that when a script is compiled and executed,
it will run in total isolation from the script host. There are some edge cases where we might want to opt out of this default. For instance if the script or any
of its dependencies does a `Assembly.Load`. In that case the isolated load context used by `Dotnet-Script` will not be able to use that assembly.
To opt out of the isolated load context, pass the `--disable-isolated-load-context` flag when executing the script.

### Caching

We provide two types of caching, the `dependency cache` and the `execution cache` which is explained in detail below. In order for any of these caches to be enabled, it is required that all NuGet package references are specified using an exact version number. The reason for this constraint is that we need to make sure that we don't execute a script with a stale dependency graph.
Expand Down
1 change: 1 addition & 0 deletions build/Build.csx
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ private void RunTests()
{
Command.Execute("dotnet", "test -c Release -f net8.0", testProjectFolder);
Command.Execute("dotnet", "test -c Release -f net9.0", testProjectFolder);
Command.Execute("dotnet", "test -c Release -f net10.0", testProjectFolder);
if (BuildEnvironment.IsWindows)
{
DotNet.Test(testDesktopProjectFolder);
Expand Down
2 changes: 1 addition & 1 deletion build/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM mcr.microsoft.com/dotnet/sdk:9.0
FROM mcr.microsoft.com/dotnet/sdk:10.0

# https://www.nuget.org/packages/dotnet-script/
RUN dotnet tool install dotnet-script --tool-path /usr/bin
Expand Down
4 changes: 2 additions & 2 deletions global.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"sdk": {
"version": "9.0.100",
"version": "10.0.100",
"rollForward": "latestFeature"
}
}
}
3 changes: 1 addition & 2 deletions src/Dotnet.Script.Core/Dotnet.Script.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<Description>A cross platform library allowing you to run C# (CSX) scripts with support for debugging and inline NuGet packages. Based on Roslyn.</Description>
<VersionPrefix>1.7.0</VersionPrefix>
<Authors>filipw</Authors>
<TargetFrameworks>net9.0;net8.0;netstandard2.0</TargetFrameworks>
<TargetFrameworks>net10.0;net9.0;net8.0;netstandard2.0</TargetFrameworks>
<AssemblyName>Dotnet.Script.Core</AssemblyName>
<PackageId>Dotnet.Script.Core</PackageId>
<PackageTags>script;csx;csharp;roslyn</PackageTags>
Expand Down Expand Up @@ -32,7 +32,6 @@
</ItemGroup>
<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard2.0' ">
<PackageReference Include="System.Text.Json" Version="8.0.5" />
<PackageReference Include="System.ValueTuple" Version="4.5.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Dotnet.Script.DependencyModel.Nuget\Dotnet.Script.DependencyModel.NuGet.csproj" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
<EmbeddedResource Include="ProjectSystem\csproj.template" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="NuGet.ProjectModel" Version="6.10.0" />
<PackageReference Include="NuGet.ProjectModel" Version="6.14.0" />
<PackageReference Include="Microsoft.DotNet.PlatformAbstractions" Version="3.1.6" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ public class PackageVersion : IEquatable<PackageVersion>
/// <param name="version">The string representation of the package version.</param>
public PackageVersion(string version)
{
version = string.IsNullOrWhiteSpace(version) ? "*" : version;
Value = version;
IsPinned = IsPinnedRegex.IsMatch(version);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

namespace Dotnet.Script.Desktop.Tests
{
[Collection("IntegrationTests")]
public class CompilationDependencyTests
{
public CompilationDependencyTests(ITestOutputHelper testOutputHelper)
Expand Down
1 change: 1 addition & 0 deletions src/Dotnet.Script.Tests/CachedRestorerTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

namespace Dotnet.Script.Tests
{
[Collection("IntegrationTests")]
public class CachedRestorerTests
{
private static readonly string[] NoPackageSources = Array.Empty<string>();
Expand Down
2 changes: 1 addition & 1 deletion src/Dotnet.Script.Tests/Dotnet.Script.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net9.0;net8.0</TargetFrameworks>
<TargetFrameworks>net10.0;net9.0;net8.0</TargetFrameworks>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>../dotnet-script.snk</AssemblyOriginatorKeyFile>
Expand Down
1 change: 1 addition & 0 deletions src/Dotnet.Script.Tests/DotnetRestorerTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

namespace Dotnet.Script.Tests
{
[Collection("IntegrationTests")]
public class DotnetRestorerTests
{
private static PackageReference ValidPackageReferenceA => new PackageReference("Newtonsoft.Json", "12.0.3");
Expand Down
1 change: 1 addition & 0 deletions src/Dotnet.Script.Tests/EnvironmentTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

namespace Dotnet.Script.Tests
{
[Collection("IntegrationTests")]
public class EnvironmentTests
{
[Theory]
Expand Down
1 change: 1 addition & 0 deletions src/Dotnet.Script.Tests/ExecutionCacheTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

namespace Dotnet.Script.Tests
{
[Collection("IntegrationTests")]
public class ExecutionCacheTests
{
private readonly ITestOutputHelper testOutputHelper;
Expand Down
13 changes: 7 additions & 6 deletions src/Dotnet.Script.Tests/FileUtilsTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,20 @@

namespace Dotnet.Script.Tests
{
[Collection("IntegrationTests")]
public class FileUtilsTests
{
[Fact]
public void GetTempPathCanBeOverridenWithAbsolutePathViaEnvVar()
{
var path = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile);
try
try
{
Environment.SetEnvironmentVariable("DOTNET_SCRIPT_CACHE_LOCATION", path);
var tempPath = FileUtils.GetTempPath();
Assert.Equal(path, tempPath);
}
finally
}
finally
{
Environment.SetEnvironmentVariable("DOTNET_SCRIPT_CACHE_LOCATION", null);
}
Expand All @@ -27,13 +28,13 @@ public void GetTempPathCanBeOverridenWithAbsolutePathViaEnvVar()
public void GetTempPathCanBeOverridenWithRelativePathViaEnvVar()
{
var path = "foo";
try
try
{
Environment.SetEnvironmentVariable("DOTNET_SCRIPT_CACHE_LOCATION", path);
var tempPath = FileUtils.GetTempPath();
Assert.Equal(Path.Combine(Directory.GetCurrentDirectory(), path), tempPath);
}
finally
}
finally
{
Environment.SetEnvironmentVariable("DOTNET_SCRIPT_CACHE_LOCATION", null);
}
Expand Down
3 changes: 2 additions & 1 deletion src/Dotnet.Script.Tests/NuGetSourceReferenceResolverTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

namespace Dotnet.Script.Tests
{
[Collection("IntegrationTests")]
public class NuGetSourceReferenceResolverTests
{
[Fact]
Expand All @@ -16,6 +17,6 @@ public void ShouldHandleResolvingInvalidPackageReference()
Dictionary<string, IReadOnlyList<string>> scriptMap = new Dictionary<string, IReadOnlyList<string>>();
NuGetSourceReferenceResolver resolver = new NuGetSourceReferenceResolver(new SourceFileResolver(ImmutableArray<string>.Empty, Directory.GetCurrentDirectory()), scriptMap);
resolver.ResolveReference("nuget:InvalidPackage, 1.2.3", Directory.GetCurrentDirectory());
}
}
}
}
1 change: 1 addition & 0 deletions src/Dotnet.Script.Tests/PackageVersionTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ namespace Dotnet.Script.Tests
/// Tests based on https://docs.microsoft.com/en-us/nuget/reference/package-versioning
/// Semantically versioned packages following the Major.Minor.Revision pattern are also considered "pinned"
/// </summary>
[Collection("IntegrationTests")]
public class PackageVersionTests
{
[Theory]
Expand Down
19 changes: 10 additions & 9 deletions src/Dotnet.Script.Tests/ProjectFileTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

namespace Dotnet.Script.Tests
{
[Collection("IntegrationTests")]
public class ProjectFileTests
{
[Fact]
Expand All @@ -26,12 +27,12 @@ public void ShouldParseProjectFile()
public void ShouldBeEqualWhenPackagesAreEqual()
{
var firstFile = new ProjectFile();
firstFile.PackageReferences.Add(new PackageReference("SomePackage","1.2.3"));
firstFile.PackageReferences.Add(new PackageReference("AnotherPackage","3.2.1"));
firstFile.PackageReferences.Add(new PackageReference("SomePackage", "1.2.3"));
firstFile.PackageReferences.Add(new PackageReference("AnotherPackage", "3.2.1"));

var secondFile = new ProjectFile();
secondFile.PackageReferences.Add(new PackageReference("SomePackage","1.2.3"));
secondFile.PackageReferences.Add(new PackageReference("AnotherPackage","3.2.1"));
secondFile.PackageReferences.Add(new PackageReference("SomePackage", "1.2.3"));
secondFile.PackageReferences.Add(new PackageReference("AnotherPackage", "3.2.1"));

Assert.Equal(firstFile, secondFile);
}
Expand All @@ -40,11 +41,11 @@ public void ShouldBeEqualWhenPackagesAreEqual()
public void ShouldNotBeEqualWhenPackagesAreDifferent()
{
var firstFile = new ProjectFile();
firstFile.PackageReferences.Add(new PackageReference("SomePackage","1.2.3"));
firstFile.PackageReferences.Add(new PackageReference("AnotherPackage","3.2.1"));
firstFile.PackageReferences.Add(new PackageReference("SomePackage", "1.2.3"));
firstFile.PackageReferences.Add(new PackageReference("AnotherPackage", "3.2.1"));

var secondFile = new ProjectFile();
secondFile.PackageReferences.Add(new PackageReference("SomePackage","1.2.3"));
secondFile.PackageReferences.Add(new PackageReference("SomePackage", "1.2.3"));

Assert.NotEqual(firstFile, secondFile);
}
Expand Down Expand Up @@ -80,8 +81,8 @@ public void ShouldNotBeEqualWhenReferencesAreDifferent()
public void ShouldBeCacheableWhenPackagesArePinned()
{
var projectFile = new ProjectFile();
projectFile.PackageReferences.Add(new PackageReference("SomePackage","1.2.3"));
projectFile.PackageReferences.Add(new PackageReference("AnotherPackage","3.2.1"));
projectFile.PackageReferences.Add(new PackageReference("SomePackage", "1.2.3"));
projectFile.PackageReferences.Add(new PackageReference("AnotherPackage", "3.2.1"));

}
}
Expand Down
1 change: 1 addition & 0 deletions src/Dotnet.Script.Tests/ScaffoldingTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

namespace Dotnet.Script.Tests
{
[Collection("IntegrationTests")]
public class ScaffoldingTests
{
private readonly ScriptEnvironment _scriptEnvironment;
Expand Down
15 changes: 8 additions & 7 deletions src/Dotnet.Script.Tests/ScriptExecutionTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
namespace Dotnet.Script.Tests
{
[Collection("IntegrationTests")]
// Removed duplicate
public class ScriptExecutionTests
{
public ScriptExecutionTests(ITestOutputHelper testOutputHelper)
Expand Down Expand Up @@ -464,14 +465,14 @@ public void ShouldIgnoreGlobalJsonInScriptFolder()
[Fact]
public void ShouldIsolateScriptAssemblies()
{
var (output, _) = ScriptTestRunner.Default.ExecuteFixture("Isolation", "--isolated-load-context");
var (output, _) = ScriptTestRunner.Default.ExecuteFixture("Isolation");
Assert.Contains("2.0.0.0", output);
}

[Fact]
public void ShouldSetCurrentContextualReflectionContext()
{
var (output, _) = ScriptTestRunner.Default.ExecuteFixture("CurrentContextualReflectionContext", "--isolated-load-context");
var (output, _) = ScriptTestRunner.Default.ExecuteFixture("CurrentContextualReflectionContext");
Assert.Contains("Dotnet.Script.Core.ScriptAssemblyLoadContext", output);
}

Expand All @@ -483,16 +484,16 @@ public void ShouldCompileAndExecuteWithWebSdk()
Assert.Equal(0, processResult.ExitCode);
}
#endif

#if NET7_0
[Fact]
public void ShouldCompileAndExecuteWithWebSdk()
{
var processResult = ScriptTestRunner.Default.ExecuteFixture("WebApi", "--no-cache");
Assert.Equal(0, processResult.ExitCode);
}
#endif
#endif

#if NET8_0
// .NET 8.0 only works with isolated load context
[Fact]
Expand All @@ -501,8 +502,8 @@ public void ShouldCompileAndExecuteWithWebSdk()
var processResult = ScriptTestRunner.Default.ExecuteFixture("WebApi", "--no-cache");
Assert.Equal(0, processResult.ExitCode);
}
#endif
#endif

[Fact]
public void ShouldThrowExceptionWhenSdkIsNotSupported()
{
Expand Down
1 change: 1 addition & 0 deletions src/Dotnet.Script.Tests/ScriptFilesResolverTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

namespace Dotnet.Script.Tests
{
[Collection("IntegrationTests")]
public class ScriptFilesResolverTests
{
[Fact]
Expand Down
3 changes: 2 additions & 1 deletion src/Dotnet.Script.Tests/ScriptParserTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

namespace Dotnet.Script.Tests
{
[Collection("IntegrationTests")]
public class ScriptParserTests
{
private readonly ScriptEnvironment _scriptEnvironment;
Expand All @@ -25,7 +26,7 @@

var result = parser.ParseFromCode("#r \"nuget:Package, 1.2.3\"");

Assert.Equal(1, result.PackageReferences.Count);

Check warning on line 29 in src/Dotnet.Script.Tests/ScriptParserTests.cs

View workflow job for this annotation

GitHub Actions / build-mac-arm

Do not use Assert.Equal() to check for collection size. Use Assert.Single instead. (https://xunit.net/xunit.analyzers/rules/xUnit2013)

Check warning on line 29 in src/Dotnet.Script.Tests/ScriptParserTests.cs

View workflow job for this annotation

GitHub Actions / build-mac-arm

Do not use Assert.Equal() to check for collection size. Use Assert.Single instead. (https://xunit.net/xunit.analyzers/rules/xUnit2013)

Check warning on line 29 in src/Dotnet.Script.Tests/ScriptParserTests.cs

View workflow job for this annotation

GitHub Actions / build-linux

Do not use Assert.Equal() to check for collection size. Use Assert.Single instead. (https://xunit.net/xunit.analyzers/rules/xUnit2013)

Check warning on line 29 in src/Dotnet.Script.Tests/ScriptParserTests.cs

View workflow job for this annotation

GitHub Actions / build-linux

Do not use Assert.Equal() to check for collection size. Use Assert.Single instead. (https://xunit.net/xunit.analyzers/rules/xUnit2013)

Check warning on line 29 in src/Dotnet.Script.Tests/ScriptParserTests.cs

View workflow job for this annotation

GitHub Actions / build-windows

Do not use Assert.Equal() to check for collection size. Use Assert.Single instead. (https://xunit.net/xunit.analyzers/rules/xUnit2013)

Check warning on line 29 in src/Dotnet.Script.Tests/ScriptParserTests.cs

View workflow job for this annotation

GitHub Actions / build-windows

Do not use Assert.Equal() to check for collection size. Use Assert.Single instead. (https://xunit.net/xunit.analyzers/rules/xUnit2013)

Check warning on line 29 in src/Dotnet.Script.Tests/ScriptParserTests.cs

View workflow job for this annotation

GitHub Actions / build-linux

Do not use Assert.Equal() to check for collection size. Use Assert.Single instead. (https://xunit.net/xunit.analyzers/rules/xUnit2013)

Check warning on line 29 in src/Dotnet.Script.Tests/ScriptParserTests.cs

View workflow job for this annotation

GitHub Actions / build-linux

Do not use Assert.Equal() to check for collection size. Use Assert.Single instead. (https://xunit.net/xunit.analyzers/rules/xUnit2013)

Check warning on line 29 in src/Dotnet.Script.Tests/ScriptParserTests.cs

View workflow job for this annotation

GitHub Actions / build-mac-arm

Do not use Assert.Equal() to check for collection size. Use Assert.Single instead. (https://xunit.net/xunit.analyzers/rules/xUnit2013)

Check warning on line 29 in src/Dotnet.Script.Tests/ScriptParserTests.cs

View workflow job for this annotation

GitHub Actions / build-mac-arm

Do not use Assert.Equal() to check for collection size. Use Assert.Single instead. (https://xunit.net/xunit.analyzers/rules/xUnit2013)

Check warning on line 29 in src/Dotnet.Script.Tests/ScriptParserTests.cs

View workflow job for this annotation

GitHub Actions / build-windows

Do not use Assert.Equal() to check for collection size. Use Assert.Single instead. (https://xunit.net/xunit.analyzers/rules/xUnit2013)

Check warning on line 29 in src/Dotnet.Script.Tests/ScriptParserTests.cs

View workflow job for this annotation

GitHub Actions / build-windows

Do not use Assert.Equal() to check for collection size. Use Assert.Single instead. (https://xunit.net/xunit.analyzers/rules/xUnit2013)
Assert.Equal("Package", result.PackageReferences.Single().Id.Value);
Assert.Equal("1.2.3", result.PackageReferences.Single().Version.Value);
}
Expand All @@ -39,9 +40,9 @@

var result = parser.ParseFromCode(code);

Assert.Equal(1, result.PackageReferences.Count);

Check warning on line 43 in src/Dotnet.Script.Tests/ScriptParserTests.cs

View workflow job for this annotation

GitHub Actions / build-mac-arm

Do not use Assert.Equal() to check for collection size. Use Assert.Single instead. (https://xunit.net/xunit.analyzers/rules/xUnit2013)

Check warning on line 43 in src/Dotnet.Script.Tests/ScriptParserTests.cs

View workflow job for this annotation

GitHub Actions / build-mac-arm

Do not use Assert.Equal() to check for collection size. Use Assert.Single instead. (https://xunit.net/xunit.analyzers/rules/xUnit2013)

Check warning on line 43 in src/Dotnet.Script.Tests/ScriptParserTests.cs

View workflow job for this annotation

GitHub Actions / build-linux

Do not use Assert.Equal() to check for collection size. Use Assert.Single instead. (https://xunit.net/xunit.analyzers/rules/xUnit2013)

Check warning on line 43 in src/Dotnet.Script.Tests/ScriptParserTests.cs

View workflow job for this annotation

GitHub Actions / build-linux

Do not use Assert.Equal() to check for collection size. Use Assert.Single instead. (https://xunit.net/xunit.analyzers/rules/xUnit2013)

Check warning on line 43 in src/Dotnet.Script.Tests/ScriptParserTests.cs

View workflow job for this annotation

GitHub Actions / build-windows

Do not use Assert.Equal() to check for collection size. Use Assert.Single instead. (https://xunit.net/xunit.analyzers/rules/xUnit2013)

Check warning on line 43 in src/Dotnet.Script.Tests/ScriptParserTests.cs

View workflow job for this annotation

GitHub Actions / build-windows

Do not use Assert.Equal() to check for collection size. Use Assert.Single instead. (https://xunit.net/xunit.analyzers/rules/xUnit2013)

Check warning on line 43 in src/Dotnet.Script.Tests/ScriptParserTests.cs

View workflow job for this annotation

GitHub Actions / build-linux

Do not use Assert.Equal() to check for collection size. Use Assert.Single instead. (https://xunit.net/xunit.analyzers/rules/xUnit2013)

Check warning on line 43 in src/Dotnet.Script.Tests/ScriptParserTests.cs

View workflow job for this annotation

GitHub Actions / build-linux

Do not use Assert.Equal() to check for collection size. Use Assert.Single instead. (https://xunit.net/xunit.analyzers/rules/xUnit2013)

Check warning on line 43 in src/Dotnet.Script.Tests/ScriptParserTests.cs

View workflow job for this annotation

GitHub Actions / build-mac-arm

Do not use Assert.Equal() to check for collection size. Use Assert.Single instead. (https://xunit.net/xunit.analyzers/rules/xUnit2013)

Check warning on line 43 in src/Dotnet.Script.Tests/ScriptParserTests.cs

View workflow job for this annotation

GitHub Actions / build-mac-arm

Do not use Assert.Equal() to check for collection size. Use Assert.Single instead. (https://xunit.net/xunit.analyzers/rules/xUnit2013)

Check warning on line 43 in src/Dotnet.Script.Tests/ScriptParserTests.cs

View workflow job for this annotation

GitHub Actions / build-windows

Do not use Assert.Equal() to check for collection size. Use Assert.Single instead. (https://xunit.net/xunit.analyzers/rules/xUnit2013)

Check warning on line 43 in src/Dotnet.Script.Tests/ScriptParserTests.cs

View workflow job for this annotation

GitHub Actions / build-windows

Do not use Assert.Equal() to check for collection size. Use Assert.Single instead. (https://xunit.net/xunit.analyzers/rules/xUnit2013)
Assert.Equal("Package", result.PackageReferences.Single().Id.Value);
Assert.Equal(string.Empty, result.PackageReferences.Single().Version.Value);
Assert.Equal("*", result.PackageReferences.Single().Version.Value);
}

[Fact]
Expand All @@ -51,7 +52,7 @@

var result = parser.ParseFromCode("#load \"nuget:Package, 1.2.3\"");

Assert.Equal(1, result.PackageReferences.Count);

Check warning on line 55 in src/Dotnet.Script.Tests/ScriptParserTests.cs

View workflow job for this annotation

GitHub Actions / build-mac-arm

Do not use Assert.Equal() to check for collection size. Use Assert.Single instead. (https://xunit.net/xunit.analyzers/rules/xUnit2013)

Check warning on line 55 in src/Dotnet.Script.Tests/ScriptParserTests.cs

View workflow job for this annotation

GitHub Actions / build-mac-arm

Do not use Assert.Equal() to check for collection size. Use Assert.Single instead. (https://xunit.net/xunit.analyzers/rules/xUnit2013)

Check warning on line 55 in src/Dotnet.Script.Tests/ScriptParserTests.cs

View workflow job for this annotation

GitHub Actions / build-linux

Do not use Assert.Equal() to check for collection size. Use Assert.Single instead. (https://xunit.net/xunit.analyzers/rules/xUnit2013)

Check warning on line 55 in src/Dotnet.Script.Tests/ScriptParserTests.cs

View workflow job for this annotation

GitHub Actions / build-linux

Do not use Assert.Equal() to check for collection size. Use Assert.Single instead. (https://xunit.net/xunit.analyzers/rules/xUnit2013)

Check warning on line 55 in src/Dotnet.Script.Tests/ScriptParserTests.cs

View workflow job for this annotation

GitHub Actions / build-windows

Do not use Assert.Equal() to check for collection size. Use Assert.Single instead. (https://xunit.net/xunit.analyzers/rules/xUnit2013)

Check warning on line 55 in src/Dotnet.Script.Tests/ScriptParserTests.cs

View workflow job for this annotation

GitHub Actions / build-windows

Do not use Assert.Equal() to check for collection size. Use Assert.Single instead. (https://xunit.net/xunit.analyzers/rules/xUnit2013)

Check warning on line 55 in src/Dotnet.Script.Tests/ScriptParserTests.cs

View workflow job for this annotation

GitHub Actions / build-linux

Do not use Assert.Equal() to check for collection size. Use Assert.Single instead. (https://xunit.net/xunit.analyzers/rules/xUnit2013)

Check warning on line 55 in src/Dotnet.Script.Tests/ScriptParserTests.cs

View workflow job for this annotation

GitHub Actions / build-linux

Do not use Assert.Equal() to check for collection size. Use Assert.Single instead. (https://xunit.net/xunit.analyzers/rules/xUnit2013)

Check warning on line 55 in src/Dotnet.Script.Tests/ScriptParserTests.cs

View workflow job for this annotation

GitHub Actions / build-mac-arm

Do not use Assert.Equal() to check for collection size. Use Assert.Single instead. (https://xunit.net/xunit.analyzers/rules/xUnit2013)

Check warning on line 55 in src/Dotnet.Script.Tests/ScriptParserTests.cs

View workflow job for this annotation

GitHub Actions / build-mac-arm

Do not use Assert.Equal() to check for collection size. Use Assert.Single instead. (https://xunit.net/xunit.analyzers/rules/xUnit2013)

Check warning on line 55 in src/Dotnet.Script.Tests/ScriptParserTests.cs

View workflow job for this annotation

GitHub Actions / build-windows

Do not use Assert.Equal() to check for collection size. Use Assert.Single instead. (https://xunit.net/xunit.analyzers/rules/xUnit2013)

Check warning on line 55 in src/Dotnet.Script.Tests/ScriptParserTests.cs

View workflow job for this annotation

GitHub Actions / build-windows

Do not use Assert.Equal() to check for collection size. Use Assert.Single instead. (https://xunit.net/xunit.analyzers/rules/xUnit2013)
Assert.Equal("Package", result.PackageReferences.Single().Id.Value);
Assert.Equal("1.2.3", result.PackageReferences.Single().Version.Value);
}
Expand All @@ -69,7 +70,7 @@

var result = parser.ParseFromCode(code.ToString());

Assert.Equal(1, result.PackageReferences.Count);

Check warning on line 73 in src/Dotnet.Script.Tests/ScriptParserTests.cs

View workflow job for this annotation

GitHub Actions / build-mac-arm

Do not use Assert.Equal() to check for collection size. Use Assert.Single instead. (https://xunit.net/xunit.analyzers/rules/xUnit2013)

Check warning on line 73 in src/Dotnet.Script.Tests/ScriptParserTests.cs

View workflow job for this annotation

GitHub Actions / build-mac-arm

Do not use Assert.Equal() to check for collection size. Use Assert.Single instead. (https://xunit.net/xunit.analyzers/rules/xUnit2013)

Check warning on line 73 in src/Dotnet.Script.Tests/ScriptParserTests.cs

View workflow job for this annotation

GitHub Actions / build-linux

Do not use Assert.Equal() to check for collection size. Use Assert.Single instead. (https://xunit.net/xunit.analyzers/rules/xUnit2013)

Check warning on line 73 in src/Dotnet.Script.Tests/ScriptParserTests.cs

View workflow job for this annotation

GitHub Actions / build-linux

Do not use Assert.Equal() to check for collection size. Use Assert.Single instead. (https://xunit.net/xunit.analyzers/rules/xUnit2013)

Check warning on line 73 in src/Dotnet.Script.Tests/ScriptParserTests.cs

View workflow job for this annotation

GitHub Actions / build-windows

Do not use Assert.Equal() to check for collection size. Use Assert.Single instead. (https://xunit.net/xunit.analyzers/rules/xUnit2013)

Check warning on line 73 in src/Dotnet.Script.Tests/ScriptParserTests.cs

View workflow job for this annotation

GitHub Actions / build-windows

Do not use Assert.Equal() to check for collection size. Use Assert.Single instead. (https://xunit.net/xunit.analyzers/rules/xUnit2013)

Check warning on line 73 in src/Dotnet.Script.Tests/ScriptParserTests.cs

View workflow job for this annotation

GitHub Actions / build-linux

Do not use Assert.Equal() to check for collection size. Use Assert.Single instead. (https://xunit.net/xunit.analyzers/rules/xUnit2013)

Check warning on line 73 in src/Dotnet.Script.Tests/ScriptParserTests.cs

View workflow job for this annotation

GitHub Actions / build-linux

Do not use Assert.Equal() to check for collection size. Use Assert.Single instead. (https://xunit.net/xunit.analyzers/rules/xUnit2013)

Check warning on line 73 in src/Dotnet.Script.Tests/ScriptParserTests.cs

View workflow job for this annotation

GitHub Actions / build-mac-arm

Do not use Assert.Equal() to check for collection size. Use Assert.Single instead. (https://xunit.net/xunit.analyzers/rules/xUnit2013)

Check warning on line 73 in src/Dotnet.Script.Tests/ScriptParserTests.cs

View workflow job for this annotation

GitHub Actions / build-mac-arm

Do not use Assert.Equal() to check for collection size. Use Assert.Single instead. (https://xunit.net/xunit.analyzers/rules/xUnit2013)

Check warning on line 73 in src/Dotnet.Script.Tests/ScriptParserTests.cs

View workflow job for this annotation

GitHub Actions / build-windows

Do not use Assert.Equal() to check for collection size. Use Assert.Single instead. (https://xunit.net/xunit.analyzers/rules/xUnit2013)

Check warning on line 73 in src/Dotnet.Script.Tests/ScriptParserTests.cs

View workflow job for this annotation

GitHub Actions / build-windows

Do not use Assert.Equal() to check for collection size. Use Assert.Single instead. (https://xunit.net/xunit.analyzers/rules/xUnit2013)
Assert.Equal("Package", result.PackageReferences.Single().Id.Value);
Assert.Equal("1.2.3-beta-1", result.PackageReferences.Single().Version.Value);
}
Expand Down Expand Up @@ -120,7 +121,7 @@

var result = parser.ParseFromCode(code);

Assert.Equal(0, result.PackageReferences.Count);

Check warning on line 124 in src/Dotnet.Script.Tests/ScriptParserTests.cs

View workflow job for this annotation

GitHub Actions / build-mac-arm

Do not use Assert.Equal() to check for collection size. Use Assert.Empty instead. (https://xunit.net/xunit.analyzers/rules/xUnit2013)

Check warning on line 124 in src/Dotnet.Script.Tests/ScriptParserTests.cs

View workflow job for this annotation

GitHub Actions / build-mac-arm

Do not use Assert.Equal() to check for collection size. Use Assert.Empty instead. (https://xunit.net/xunit.analyzers/rules/xUnit2013)

Check warning on line 124 in src/Dotnet.Script.Tests/ScriptParserTests.cs

View workflow job for this annotation

GitHub Actions / build-linux

Do not use Assert.Equal() to check for collection size. Use Assert.Empty instead. (https://xunit.net/xunit.analyzers/rules/xUnit2013)

Check warning on line 124 in src/Dotnet.Script.Tests/ScriptParserTests.cs

View workflow job for this annotation

GitHub Actions / build-linux

Do not use Assert.Equal() to check for collection size. Use Assert.Empty instead. (https://xunit.net/xunit.analyzers/rules/xUnit2013)

Check warning on line 124 in src/Dotnet.Script.Tests/ScriptParserTests.cs

View workflow job for this annotation

GitHub Actions / build-windows

Do not use Assert.Equal() to check for collection size. Use Assert.Empty instead. (https://xunit.net/xunit.analyzers/rules/xUnit2013)

Check warning on line 124 in src/Dotnet.Script.Tests/ScriptParserTests.cs

View workflow job for this annotation

GitHub Actions / build-windows

Do not use Assert.Equal() to check for collection size. Use Assert.Empty instead. (https://xunit.net/xunit.analyzers/rules/xUnit2013)

Check warning on line 124 in src/Dotnet.Script.Tests/ScriptParserTests.cs

View workflow job for this annotation

GitHub Actions / build-linux

Do not use Assert.Equal() to check for collection size. Use Assert.Empty instead. (https://xunit.net/xunit.analyzers/rules/xUnit2013)

Check warning on line 124 in src/Dotnet.Script.Tests/ScriptParserTests.cs

View workflow job for this annotation

GitHub Actions / build-linux

Do not use Assert.Equal() to check for collection size. Use Assert.Empty instead. (https://xunit.net/xunit.analyzers/rules/xUnit2013)

Check warning on line 124 in src/Dotnet.Script.Tests/ScriptParserTests.cs

View workflow job for this annotation

GitHub Actions / build-mac-arm

Do not use Assert.Equal() to check for collection size. Use Assert.Empty instead. (https://xunit.net/xunit.analyzers/rules/xUnit2013)

Check warning on line 124 in src/Dotnet.Script.Tests/ScriptParserTests.cs

View workflow job for this annotation

GitHub Actions / build-mac-arm

Do not use Assert.Equal() to check for collection size. Use Assert.Empty instead. (https://xunit.net/xunit.analyzers/rules/xUnit2013)

Check warning on line 124 in src/Dotnet.Script.Tests/ScriptParserTests.cs

View workflow job for this annotation

GitHub Actions / build-windows

Do not use Assert.Equal() to check for collection size. Use Assert.Empty instead. (https://xunit.net/xunit.analyzers/rules/xUnit2013)

Check warning on line 124 in src/Dotnet.Script.Tests/ScriptParserTests.cs

View workflow job for this annotation

GitHub Actions / build-windows

Do not use Assert.Equal() to check for collection size. Use Assert.Empty instead. (https://xunit.net/xunit.analyzers/rules/xUnit2013)
}

private ScriptParser CreateParser()
Expand Down
1 change: 1 addition & 0 deletions src/Dotnet.Script.Tests/ScriptPublisherTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

namespace Dotnet.Script.Tests
{
[Collection("IntegrationTests")]
public class ScriptPublisherTests
{
private readonly ScriptEnvironment _scriptEnvironment;
Expand Down
1 change: 1 addition & 0 deletions src/Dotnet.Script.Tests/ScriptRunnerTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

namespace Dotnet.Script.Tests
{
[Collection("IntegrationTests")]
public class ScriptRunnerTests
{
[Fact]
Expand Down
2 changes: 2 additions & 0 deletions src/Dotnet.Script.Tests/ScriptTestRunner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@
using System.Linq;
using Dotnet.Script.DependencyModel.Environment;
using Dotnet.Script.Shared.Tests;
using Xunit;

namespace Dotnet.Script.Tests
{
[Collection("IntegrationTests")]
public class ScriptTestRunner
{
public static readonly ScriptTestRunner Default = new ScriptTestRunner();
Expand Down
Loading
Loading