BlazorFocused.Automation.PowerShell.Tools
1.1.0-preview1
This is a prerelease version of BlazorFocused.Automation.PowerShell.Tools.
dotnet add package BlazorFocused.Automation.PowerShell.Tools --version 1.1.0-preview1
NuGet\Install-Package BlazorFocused.Automation.PowerShell.Tools -Version 1.1.0-preview1
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="BlazorFocused.Automation.PowerShell.Tools" Version="1.1.0-preview1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add BlazorFocused.Automation.PowerShell.Tools --version 1.1.0-preview1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: BlazorFocused.Automation.PowerShell.Tools, 1.1.0-preview1"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install BlazorFocused.Automation.PowerShell.Tools as a Cake Addin #addin nuget:?package=BlazorFocused.Automation.PowerShell.Tools&version=1.1.0-preview1&prerelease // Install BlazorFocused.Automation.PowerShell.Tools as a Cake Tool #tool nuget:?package=BlazorFocused.Automation.PowerShell.Tools&version=1.1.0-preview1&prerelease
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
BlazorFocused.Automation.PowerShell.Tools
Development tools for running/testing PSCmdlets built with Automation framework
NuGet Packages
Package | Description |
---|---|
BlazorFocused.Automation.PowerShell.Tools | Development tools for running/testing PSCmdlets built with Automation framework |
Documentation
Please visit the BlazorFocused.Automation Documentation Site for installation, getting started, and API documentation.
Samples
Please visit and/or download our BlazorFocused.Automation.PowerShell.Tools Sample Solution to get a more in-depth view of usage.
Requirements
- PowerShell 7.3 or greater
Installation
.NET CLI
dotnet add package BlazorFocused.Automation.PowerShell.Tools
Testing AutomationIoC PSCmdlets
Sample AutomationIoC PSCmdlet startup class
public class Startup : AutomationStartup
{
// Add any configuration sources or data needed
public override void Configure(HostBuilderContext hostBuilderContext, IConfigurationBuilder configurationBuilder)
{
// AutomationEnvironment class allows retrieving global PowerShell
// variables during service configuration.
var environment =
AutomationEnvironment.GetVariable<string>("AppEnvironment");
var appSettings = new Dictionary<string, string>()
{
["TestOptionsConfig:TestProperty"] = "This is an example",
["AppEnvironment"] = environment
};
configurationBuilder.AddInMemoryCollection(appSettings);
}
// Configure services/lifetimes
public override void ConfigureServices(HostBuilderContext hostBuilderContext, IServiceCollection services)
{
services.Configure<TestOptions>(Configuration.GetSection("TestOptionsConfig"));
services.AddTransient<ITestDependencyOne, TestDependencyOne>();
services.AddTransient<ITestDependencyTwo, TestDependencyTwo>();
// ...
// other services, client, etc.
}
}
Sample Automation PSCmdlet to test
[Cmdlet(VerbsLifecycle.Submit, "Data")]
public class SubmitData : AutomationShell<Startup>
{
[Parameter(Mandatory = true)]
public string Id { get; set; }
[AutomationDependency]
protected ITestDependencyOne TestDependencyOne { get; set; }
[AutomationDependency]
protected ITestDependencyTwo testDependencyTwo { get; set; }
[AutomationDependency]
private ILogger<RequestCard> logger { get; set; }
protected override void ProcessRecord()
{
base.ProcessRecord();
TestDependencyOne.PushTestId(Id);
TestData testData = testDependencyTwo.GetTestData(Id);
logger.LogInformation("Auto Generated Data: {Id} - {Name}", Id, testData.Name);
WriteObject(testData);
}
}
Sample Test
using AutomationIoC.PSCmdlets.Tools;
using FluentAssertions;
using Xunit;
public class RequestCardTests
{
[Fact]
public void ShouldSubmitData()
{
var testDependencyOneMock = new Mock<ITestDependencyOne>();
var testDependencyTwoMock = new Mock<ITestDependencyTwo>();
var testId = "ThisIsATestId";
var expectedTestData = new TestData { Id = testId, Name = "ThisIsTestName" };
testDependencyTwoMock.Setup(dependency =>
dependency.GetTestDataAsync(testId))
.Returns(expectedTestData);
// Creates inline context of the command under test
using var submitDataCommand =
AutomationSandbox.CreateContext<SubmitData, Startup>(services =>
{
services.AddTransient(_ => testDependencyOneMock.Object);
services.AddTransient(_ => testDependencyTwoMock.Object);
});
submitDataCommand.AddParameter(command =>
command.AddParameter("id", testId));
var actualTestData = submitDataCommand.RunCommand<TestData>().First();
actualTestData.Should().BeEquivalentTo(expectedTestData);
}
}
Other Resources
Related Packages
Package | Description |
---|---|
BlazorFocused.Automation.Runtime | Runtime services for BlazorFocused.Automation framework |
BlazorFocused.Automation.CommandLine | Dependency Injection Framework for C# Console Applications |
BlazorFocused.Automation.PowerShell | PowerShell PSCmdlet SDK utilities for Automation framework development |
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. 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 was computed. 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 was computed. 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. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
.NETStandard 2.1
- BlazorFocused.Automation.PowerShell (>= 1.1.0-preview1)
- Microsoft.PowerShell.SDK (>= 7.4.6)
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 |
---|---|---|
1.1.0-preview1 | 23 | 11/21/2024 |
1.0.0-preview1 | 82 | 2/27/2024 |
1.0.0-alpha1 | 97 | 9/29/2023 |