Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using NUnit.Framework;
- using System;
- using System.Collections.Generic;
- using System.Management.Automation.Runspaces;
- namespace CoreView.Management.PowerShell.Tests.InvokeCvApi {
- [TestFixture(Category = "Integration")]
- public class InvokeCvApiIntegrationTests {
- [Test]
- public void Cmdlet_Must_Have_Correct_Base_Parameters_Provided() {
- using (var powerShell = PSHostHelper.GetPowerShellHost()) {
- powerShell.AddCommand("Invoke-CVApi");
- powerShell.AddParameter("Username", "user");
- powerShell.AddParameter("Password", "pass");
- powerShell.AddParameter("Function",
- new FunctionInvocationData("branchStatus",
- new List<FunctionInvocationParam> {new FunctionInvocationParam("Status", "O")}));
- dynamic results = powerShell.Invoke();
- //Assert.That(ResultOk(results));
- }
- }
- }
- public static class PSHostHelper {
- public static System.Management.Automation.PowerShell GetPowerShellHost() {
- var iss = InitialSessionState.CreateDefault();
- #if DEBUG
- iss.ImportPSModule(new[] { @"..\..\..\CoreView.Management.PowerShell\bin\Debug\net48\CoreView.Management.PowerShell.dll", "-Force" });
- #else
- iss.ImportPSModule(new[] { @"..\..\..\CoreView.Management.PowerShell\bin\Release\net48\CoreView.Management.PowerShell.dll", "-Force" });
- #endif
- var ps = System.Management.Automation.PowerShell.Create(iss);
- return ps;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement