Skip to content
This repository has been archived by the owner on Jul 18, 2024. It is now read-only.

Commit

Permalink
Update readme and template
Browse files Browse the repository at this point in the history
  • Loading branch information
NikolayPianikov committed Jul 5, 2024
1 parent 8b42581 commit fcc69b5
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 14 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Run this from the working directory where the solution or project to build is located.
using HostApi;
using HostApi;

// Builds a dotnet solution or project
return new DotNetBuild().Build().ExitCode ?? 1;
Original file line number Diff line number Diff line change
@@ -1,18 +1,23 @@
// Run this from the working directory where the solution or project to build is located.
// To run the script:
// - Install "dotnet-csi" as a tool using the "dotnet tool" command, for example:
// dotnet tool install dotnet-csi -g
// - Run this script from the working directory
// containing the solution or project to be built, for example:
// dotnet csi ./build/Program.csx

// Changes a verbosity level (Quiet, Normal, or Diagnostic).
// To change the logging level (Quiet, Normal or Diagnostic):
// #l Diagnostic

// Adds a NuGet package and references to assemblies.
// To add a reference to the NuGet package:
// #r "nuget: MyPackage, 1.2.3"

// Adds an assembly reference.
// To add an assembly reference:
// #r "MyAssembly.dll"

// Includes code from a file in the order it should run.
// To include code from the file in the order in which it should be executed:
// #load "MyClass.cs"

// Please see the page below for more details.
// More information can be found on the page:
// https://github.com/DevTeam/csharp-interactive

#load "Program.cs"
17 changes: 11 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -482,7 +482,7 @@ result.ExitCode.ShouldBe(0);
result = new DotNetTest().WithWorkingDirectory("MyLib").Build();
result.ExitCode.ShouldBe(0);
result.Summary.Tests.ShouldBe(1);
result.Tests.Count(test => test.State == TestState.Passed).ShouldBe(1);
result.Tests.Count(test => test.State == TestState.Finished).ShouldBe(1);
```


Expand Down Expand Up @@ -550,7 +550,7 @@ result = new MSBuild()
// The "result" variable provides details about a build
result.ExitCode.ShouldBe(0);
result.Summary.Tests.ShouldBe(1);
result.Tests.Count(test => test.State == TestState.Passed).ShouldBe(1);
result.Tests.Count(test => test.State == TestState.Finished).ShouldBe(1);
```


Expand Down Expand Up @@ -657,7 +657,7 @@ result = new DotNetTest().WithWorkingDirectory("MyTests").Build();
// The "result" variable provides details about a build
result.ExitCode.ShouldBe(0);
result.Summary.Tests.ShouldBe(1);
result.Tests.Count(test => test.State == TestState.Passed).ShouldBe(1);
result.Tests.Count(test => test.State == TestState.Finished).ShouldBe(1);
```


Expand Down Expand Up @@ -704,7 +704,7 @@ var result = testUnderDotCover.Build();

// The "result" variable provides details about a build
result.ExitCode.ShouldBe(0);
result.Tests.Count(i => i.State == TestState.Passed).ShouldBe(1);
result.Tests.Count(i => i.State == TestState.Finished).ShouldBe(1);

// Generates a HTML code coverage report.
exitCode = new DotNetCustom("dotCover", "report", $"--source={dotCoverSnapshot}", $"--output={dotCoverReport}", "--reportType=HTML").Run();
Expand Down Expand Up @@ -763,7 +763,7 @@ result = new VSTest()
// The "result" variable provides details about a build
result.ExitCode.ShouldBe(0);
result.Summary.Tests.ShouldBe(1);
result.Tests.Count(test => test.State == TestState.Passed).ShouldBe(1);
result.Tests.Count(test => test.State == TestState.Finished).ShouldBe(1);
```


Expand Down Expand Up @@ -858,10 +858,12 @@ using HostApi;
// Creates a base docker command line
var dockerRun = new DockerRun()
.WithAutoRemove(true)
.WithInteractive(true)
.WithImage("mcr.microsoft.com/dotnet/sdk")
.WithPlatform("linux")
.WithContainerWorkingDirectory("/MyProjects")
.AddVolumes((Environment.CurrentDirectory, "/MyProjects"));
.AddVolumes((ToAbsoluteLinuxPath(Environment.CurrentDirectory), "/MyProjects"));


// Creates a new library project in a docker container
var exitCode = dockerRun
Expand All @@ -878,6 +880,9 @@ var result = dockerRun
// The "result" variable provides details about a build
result.Errors.Any(message => message.State == BuildMessageState.StdError).ShouldBeFalse();
result.ExitCode.ShouldBe(0);

string ToAbsoluteLinuxPath(string path) =>
"/" + path.Replace(":", "").Replace('\\', '/');
```


Expand Down

0 comments on commit fcc69b5

Please sign in to comment.