LPRun 8.5.4
See the version list below for details.
dotnet add package LPRun --version 8.5.4
NuGet\Install-Package LPRun -Version 8.5.4
<PackageReference Include="LPRun" Version="8.5.4" />
paket add LPRun --version 8.5.4
#r "nuget: LPRun, 8.5.4"
// Install LPRun as a Cake Addin #addin nuget:?package=LPRun&version=8.5.4 // Install LPRun as a Cake Tool #tool nuget:?package=LPRun&version=8.5.4
LINQPad Driver LPRun Unit/Integration Tests Runner
Table of Contents
- Description
- LPRun .NET Versions
- Website
- Download
- Usage
- Known Issues
- Troubleshooting
- Authors
- Credits
- Licenses
Description
The LPRun is the LINQPad driver's unit/integration tests runner. Can be used for testing LINQPad 8/LINQPad 7/LINQPad 6 drivers or for running LINQPad scripts.
LPRun .NET Versions
.NET versions supported by LPRun are listed below. In case of unsupported version LPRun fallbacks to the latest production .NET installed.
LPRun | .NET 8.0 | .NET 7.0 | .NET 6.0 | .NET 5.0 | .NET 3.1 |
---|---|---|---|---|---|
8 | ✔️ | ✔️ | ✔️ | ||
7 | ✔️ | ✔️ | ✔️ | ✔️ |
Use the following script to check the .NET version used by LPRun:
<Query Kind="Expression"/>
System.Environment.Version
Website
The LPRun is used for testing of the CsvLINQPadDriver for LINQPad 8/7/6/5.
Download
Usage
Tested driver MUST NOT be installed via NuGet into LINQPad. In this case LPRun will use it instead of local one.
Setup
LPRun # Created by LPRun NuGet.
Templates # LINQPad script templates.
Data # Optional: Driver data files.
LINQPad Test Script Example
LPRun executes LINQPad test script. Test script uses Fluent Assertions for assertion checks.
StringComparison.linq LINQPad test script example:
var original = Books.First();
var copy = original with { Title = original.Title.ToUpper() };
var expectedEquality = original.Title.Equals(copy.Title, context.StringComparison);
original.Equals(copy).Should().Be(expectedEquality, Reason());
original.GetHashCode()
.Equals(copy.GetHashCode())
.Should()
.Be(expectedEquality, Reason());
Reason()
method (prints exact line number if assertion fails) and context
variable are injected by test below.
NUnit Test Example
Full NUnit test code can be found here.
[TestFixture]
public class LPRunTests
{
[OneTimeSetUp]
public void Init()
{
// Check that driver is not installed via NuGet.
Driver.EnsureNotInstalledViaNuGet("CsvLINQPadDriver");
// Install driver.
Driver.InstallWithDepsJson(
// The directory to copy driver files to.
"CsvLINQPadDriver",
// The LINQPad driver files.
"CsvLINQPadDriver.dll",
// The test folder path.
"Tests");
}
[Test]
[TestCaseSource(nameof(TestsData))]
public async Task Execute_ScriptWithDriverProperties_Success(
(string linqScriptName,
string? context,
ICsvDataContextDriverProperties driverProperties) testData)
{
var (linqScriptName, context, driverProperties) = testData;
// Arrange: Create query connection header. Custom code can be added here.
var queryConfig = GetQueryHeaders().Aggregate(
new StringBuilder(),
(stringBuilder, h) =>
{
stringBuilder.AppendLine(h);
stringBuilder.AppendLine();
return stringBuilder;
}).ToString();
// Arrange: Create test LNQPad script.
// You can also use LinqScript.FromScript method.
var linqScript = LinqScript.FromFile(
$"{linqScriptName}.linq",
queryConfig);
// Act: Execute test LNQPad script.
var (output, error, exitCode) =
await Runner.ExecuteAsync(linqScript);
// Assert.
error.Should().BeNullOrWhiteSpace();
exitCode.Should().Be(0);
// Helpers.
IEnumerable<string> GetQueryHeaders()
{
// Connection header.
yield return ConnectionHeader.Get(
"CsvLINQPadDriver",
"CsvLINQPadDriver.CsvDataContextDriver",
driverProperties,
"System.Runtime.CompilerServices");
// FluentAssertions helper.
yield return
"string Reason([CallerLineNumber] int sourceLineNumber = 0) =>" +
@" $""something went wrong at line #{sourceLineNumber}"";";
// Test context.
if (!string.IsNullOrWhiteSpace(context))
{
yield return $"var context = {context};";
}
}
}
private static IEnumerable<
(string linqScriptName,
string? context,
ICsvDataContextDriverProperties driverProperties)> TestsData()
{
// Omitted for brevity.
}
}
Tests can also be run in parallel:
[TestFixture]
public class LPRunTests
{
[Test]
[Parallelizable(ParallelScope.Children)]
[TestCaseSource(nameof(ParallelizableTestsData))]
public void Execute_ScriptWithDriverProperties_Success(
(string linqScriptName,
string? context,
ICsvDataContextDriverProperties driverProperties,
int index) testData)
{
// ...
// Arrange: Create test LNQPad script.
// You can also use LinqScript.FromScript method.
var linqScript = LinqScript.FromFile(
$"{linqScriptName}.linq",
queryConfig,
$"{linqScriptName}_{testData.index}");
// ...
}
private static IEnumerable<
(string linqScriptName,
string? context,
ICsvDataContextDriverProperties driverProperties,
int index)> TestsData()
{
// Omitted for brevity.
}
// Parallelized tests data.
private static IEnumerable<
(string linqScriptName,
string? context,
ICsvDataContextDriverProperties driverProperties,
int index)> ParallelizableTestsData() =>
TestsData().AugmentWithFileIndex(
static testData => testData.linqScriptName,
static (testData, index) => { testData.index = index; return testData; });
}
Known Issues
Unit-testing Frameworks Support
Tested with NUnit. Other test frameworks should work as well.
LINQPad Runtime Reference
Avoid referencing LINQPad.Runtime.dll
in your tests, e.g. for Moq:
// LINQPad.Runtime.dll IConnectionInfo reference:
var connectionInfoMock = new Mock<LINQPad.Extensibility.DataContext.IConnectionInfo>();
var driverProperties = new DriverProperties(connectionInfoMock.Object);
This code compiles but fails in runtime with Could not load file or assembly LINQPad.Runtime
error. If you still need to reference it, add the following target which copies assembly to output folder of the test project:
<Target Name="CopyLINQPadRuntimeToOutput" AfterTargets="Build">
<Copy SourceFiles="$(OutputPath)\LPRun\Bin\LINQPad.Runtime.dll" DestinationFolder="$(OutputPath)" UseHardlinksIfPossible="true" />
</Target>
Your can avoid referencing LINQPad.Runtime.dll
assembly by using mock framework facilities, e.g. for Moq you can extract IDriverProperties
interface and setup driver properties as follows:
var driverProperties = Mock.Of<IDriverProperties>(props =>
props.BoolProp == true &&
props.IntProp == 42 &&
props.StringProp == "string"
);
Authors
- Ivan Ivon
- LINQPad.Runtime/LPRun binaries (license) by Joseph Albahari
Credits
Tools
NuGet
Licenses
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 is compatible. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.1 is compatible. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.1
- No dependencies.
-
net6.0
- No dependencies.
-
net7.0
- No dependencies.
-
net8.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
8.7.2 | 108 | 11/28/2024 |
8.6.6 | 181 | 11/5/2024 |
8.6.5 | 109 | 11/1/2024 |
8.6.4 | 190 | 10/6/2024 |
8.6.2 | 218 | 9/15/2024 |
8.6.1 | 104 | 8/5/2024 |
8.5.5 | 117 | 7/26/2024 |
8.5.4 | 99 | 7/23/2024 |
8.5.3 | 165 | 7/20/2024 |
8.5.2 | 123 | 7/18/2024 |
8.5.1 | 210 | 7/4/2024 |
8.4.11 | 166 | 6/19/2024 |
8.4.10 | 118 | 6/11/2024 |
8.4.9 | 136 | 6/5/2024 |
8.4.8 | 112 | 5/27/2024 |
8.4.7 | 143 | 5/24/2024 |
8.4.5 | 146 | 5/22/2024 |
8.4.4 | 147 | 5/17/2024 |
8.4.3 | 142 | 5/14/2024 |
8.4.2 | 194 | 5/10/2024 |
8.4.1 | 204 | 4/30/2024 |
8.3.7 | 163 | 4/18/2024 |
8.3.6 | 221 | 4/14/2024 |
8.3.5 | 212 | 4/7/2024 |
8.3.3 | 192 | 3/21/2024 |
8.3.2 | 237 | 3/13/2024 |
8.3.1 | 179 | 3/12/2024 |
8.2.4 | 152 | 2/17/2024 |
8.2.3 | 161 | 2/13/2024 |
8.2.2 | 201 | 1/23/2024 |
8.1.6 | 168 | 1/17/2024 |
8.1.3 | 237 | 1/3/2024 |
8.1.2 | 215 | 12/27/2023 |
8.1.1 | 183 | 12/22/2023 |
8.0.18 | 289 | 12/5/2023 |
8.0.17 | 240 | 11/26/2023 |
8.0.16 | 254 | 11/25/2023 |
8.0.15 | 194 | 11/24/2023 |
8.0.14 | 226 | 11/22/2023 |
8.0.13 | 196 | 11/18/2023 |
8.0.12 | 204 | 11/17/2023 |
8.0.11 | 186 | 11/16/2023 |
8.0.10 | 215 | 11/15/2023 |
8.0.9 | 207 | 11/12/2023 |
7.8.10 | 151 | 2/14/2024 |
7.8.7 | 238 | 11/26/2023 |
7.8.6 | 358 | 9/14/2023 |
7.8.5 | 406 | 8/1/2023 |
7.8.4 | 320 | 7/13/2023 |
7.8.3 | 315 | 7/3/2023 |
7.8.2 | 300 | 6/16/2023 |
7.8.1 | 303 | 6/9/2023 |
7.7.15 | 287 | 5/31/2023 |
7.7.14 | 286 | 5/29/2023 |
7.7.13 | 280 | 5/23/2023 |
7.7.12 | 312 | 5/18/2023 |
7.7.11 | 337 | 5/10/2023 |
7.7.10 | 417 | 4/19/2023 |
7.7.9 | 415 | 4/4/2023 |
7.7.8 | 442 | 4/4/2023 |
7.7.7 | 494 | 3/21/2023 |
7.7.6 | 489 | 3/18/2023 |
7.7.4 | 409 | 3/13/2023 |
7.7.3 | 500 | 2/20/2023 |
7.7.2 | 428 | 2/13/2023 |
7.7.1 | 485 | 2/1/2023 |
7.6.6 | 582 | 1/5/2023 |
7.6.5 | 449 | 12/24/2022 |
7.6.4 | 485 | 12/7/2022 |
7.6.3 | 514 | 11/26/2022 |
7.6.2 | 481 | 11/16/2022 |
7.5.16 | 508 | 11/14/2022 |
7.5.15 | 509 | 11/13/2022 |
7.5.14 | 539 | 11/11/2022 |
7.5.13 | 505 | 11/10/2022 |
7.5.12 | 531 | 10/31/2022 |
7.5.11 | 573 | 10/30/2022 |
7.5.10 | 550 | 10/25/2022 |
7.5.9 | 542 | 10/9/2022 |
7.5.8 | 528 | 10/6/2022 |
7.5.7 | 544 | 10/3/2022 |
7.5.6 | 589 | 9/26/2022 |
7.5.5 | 597 | 9/23/2022 |
7.5.4 | 598 | 9/20/2022 |
7.5.3 | 591 | 9/16/2022 |
7.5.2 | 616 | 8/28/2022 |
7.5.1 | 629 | 8/26/2022 |
7.4.9.1 | 682 | 8/3/2022 |
7.4.8 | 653 | 7/31/2022 |
7.4.7 | 662 | 7/25/2022 |
7.4.6 | 681 | 7/19/2022 |
7.4.5 | 705 | 7/15/2022 |
7.4.4 | 712 | 7/6/2022 |
7.4.3 | 707 | 6/8/2022 |
7.4.2 | 699 | 5/11/2022 |
7.4.1 | 666 | 5/3/2022 |
7.3.9 | 681 | 4/19/2022 |
7.3.6 | 676 | 3/25/2022 |
7.3.5 | 647 | 3/17/2022 |
7.3.4 | 655 | 3/15/2022 |
7.3.2 | 601 | 2/23/2022 |
7.3.1 | 602 | 2/17/2022 |
6.14.11 | 519 | 9/1/2021 |
6.14.10 | 633 | 7/18/2021 |
6.13.14 | 510 | 5/10/2021 |
6.13.13 | 541 | 5/5/2021 |
LPRun 8.5.4