-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #25 from FrendsPlatform/24-powershellrunscript-and…
…-powershellruncommand-doesnt-work-in-572 #24 Updated Microsoft.Powershell.SDK dependecy to 7.2.23 to fix issue…
- Loading branch information
Showing
6 changed files
with
94 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
Frends.PowerShell.RunCommand/Frends.PowerShell.RunCommand.Tests/TaskUserInterfaceTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
using System; | ||
using System.Collections.ObjectModel; | ||
using System.Management.Automation; | ||
using System.Management.Automation.Host; | ||
using System.Security; | ||
using Frends.PowerShell.RunCommand; | ||
using NUnit.Framework; | ||
|
||
namespace Frends.PowerShell.RunScript.Tests; | ||
|
||
public class TaskUserInterfaceTests | ||
{ | ||
/// <summary> | ||
/// This user interface is a dummy implementation that does not do anything. | ||
/// Ensure that most methods can be called without exceptions. | ||
/// </summary> | ||
[Test] | ||
public void TestTheWholeThing() | ||
{ | ||
var taskUserInterface = new TaskUserInterface(); | ||
taskUserInterface.Write("Hello, World!"); | ||
taskUserInterface.Write(ConsoleColor.Black, ConsoleColor.White, "Hello, World!"); | ||
taskUserInterface.WriteLine("Hello, World!"); | ||
taskUserInterface.WriteErrorLine("Hello, World!"); | ||
taskUserInterface.WriteDebugLine("Hello, World!"); | ||
taskUserInterface.WriteProgress(1, new ProgressRecord(1, "Activity", "Status")); | ||
taskUserInterface.WriteVerboseLine("Hello, World!"); | ||
taskUserInterface.WriteWarningLine("Hello, World!"); | ||
taskUserInterface.ReadLineAsSecureString(); | ||
|
||
Assert.AreEqual("", taskUserInterface.ReadLine()); | ||
Assert.AreEqual(1, taskUserInterface.PromptForChoice("Caption", "Message", new Collection<ChoiceDescription>(), 1)); | ||
|
||
var answer = taskUserInterface.Prompt("Caption", "Message", new Collection<FieldDescription> { new ("Name") }); | ||
Assert.AreEqual(1, answer.Count); | ||
|
||
Assert.Throws<NotImplementedException>(() => taskUserInterface.PromptForCredential("Caption", "Message", "UserName", "TargetName")); | ||
Assert.Throws<NotImplementedException>(() => taskUserInterface.PromptForCredential("Caption", "Message", "UserName", "TargetName", PSCredentialTypes.Domain, PSCredentialUIOptions.Default)); | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
Frends.PowerShell.RunScript/Frends.PowerShell.RunScript.Tests/TaskUserInterfaceTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
using System; | ||
using System.Collections.ObjectModel; | ||
using System.Management.Automation; | ||
using System.Management.Automation.Host; | ||
using System.Security; | ||
using NUnit.Framework; | ||
|
||
namespace Frends.PowerShell.RunScript.Tests; | ||
|
||
public class TaskUserInterfaceTests | ||
{ | ||
/// <summary> | ||
/// This user interface is a dummy implementation that does not do anything. | ||
/// Ensure that most methods can be called without exceptions. | ||
/// </summary> | ||
[Test] | ||
public void TestTheWholeThing() | ||
{ | ||
var taskUserInterface = new TaskUserInterface(); | ||
taskUserInterface.Write("Hello, World!"); | ||
taskUserInterface.Write(ConsoleColor.Black, ConsoleColor.White, "Hello, World!"); | ||
taskUserInterface.WriteLine("Hello, World!"); | ||
taskUserInterface.WriteErrorLine("Hello, World!"); | ||
taskUserInterface.WriteDebugLine("Hello, World!"); | ||
taskUserInterface.WriteProgress(1, new ProgressRecord(1, "Activity", "Status")); | ||
taskUserInterface.WriteVerboseLine("Hello, World!"); | ||
taskUserInterface.WriteWarningLine("Hello, World!"); | ||
taskUserInterface.ReadLineAsSecureString(); | ||
|
||
Assert.AreEqual("", taskUserInterface.ReadLine()); | ||
Assert.AreEqual(1, taskUserInterface.PromptForChoice("Caption", "Message", new Collection<ChoiceDescription>(), 1)); | ||
|
||
var answer = taskUserInterface.Prompt("Caption", "Message", new Collection<FieldDescription> { new ("Name") }); | ||
Assert.AreEqual(1, answer.Count); | ||
|
||
Assert.Throws<NotImplementedException>(() => taskUserInterface.PromptForCredential("Caption", "Message", "UserName", "TargetName")); | ||
Assert.Throws<NotImplementedException>(() => taskUserInterface.PromptForCredential("Caption", "Message", "UserName", "TargetName", PSCredentialTypes.Domain, PSCredentialUIOptions.Default)); | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters