Esempio n. 1
0
 public void ConnectingPropertyToPSOutput()
 {
     var runner = new ScriptRunner()
     .SetFile("_scriptWithPowershellFillProp.txt")
     .Run();
       runner.Logged(DateTime.Now.ToString("yyyy.MM.dd")).ShouldBeTrue();
 }
Esempio n. 2
0
 public void MessagesAreObtainableFromTheScript()
 {
     var runner = new ScriptRunner()
     .SetFile("_scriptWithMessage.txt")
     .Run();
       runner.Logged("Hello from Default").ShouldBeTrue();
 }
Esempio n. 3
0
 public void ConnectingItemGroupToPSOutput()
 {
     var runner = new ScriptRunner()
     .SetFile("_scriptWithPowershell.txt")
     .Run();
       runner.Logger.LoggedMessages.Count(m=>m.EndsWith(".png")).ShouldBeGreaterThan(10);
 }
Esempio n. 4
0
 public void PowershellInlineScriptsWork()
 {
     var runner = new ScriptRunner()
     .SetFile("_scriptWithPowershellInline.txt")
     .Run();
       var msg = runner.Logger.LoggedMessages.Find(s => s.Contains("Inside the script block"));
       msg.ShouldNotBeNull();
 }
Esempio n. 5
0
 public void AForeachLoopInAScript()
 {
     var runner = new ScriptRunner()
     .SetFile("_scriptWithIteration.txt")
     .Run();
       runner.Logged("1").ShouldBeTrue();
       runner.Logged("2").ShouldBeTrue();
       runner.Logged("3").ShouldBeTrue();
 }
Esempio n. 6
0
 public void PowershellLogsArriveInMsBuild()
 {
     var runner = new ScriptRunner()
     .SetFile("_scriptPowershellWritingHost.txt")
     .Run();
       var msg = runner.Logger.LoggedMessages.Find(s => s.Contains("Hi"));
       msg.ShouldNotBeNull();
       msg = runner.Logger.LoggedMessages.Find(s => s.Contains("Ho"));
       msg.ShouldNotBeNull();
 }
Esempio n. 7
0
        public void ItemGroupUsage()
        {
            var runner = new ScriptRunner()
            .SetFile("_scriptPowershellExampleGitUsage.txt")
            .Run();

              var msg = runner.Logger.LoggedMessages.Find(s => s.Contains("gitnumber"));
              msg.ShouldNotBeNull();
              msg.Length.ShouldBeGreaterThan(19); //That would be if the vars are empty
        }
Esempio n. 8
0
 public void SetupAllowsToPassInProperties()
 {
     var runner = new ScriptRunner()
     .SetFile("_scriptWithVarOutput.txt")
     .ExposeSetup(b => b.Property = "Foo=Baz;Bar=Alice")
     .Run();
       runner.Logged("Baz").ShouldBeTrue();
       runner.Logged("Alice").ShouldBeTrue();
 }
Esempio n. 9
0
 public void RunningAScript()
 {
     var runner = new ScriptRunner()
     .SetFile("_scriptWithPowershellExecAsTask.txt")
     .Run();
       var createdFile = Path.Combine(Path.GetTempPath(), "testtest.tst");
       File.Exists(createdFile).ShouldBeTrue();
       File.Delete(createdFile);
 }
Esempio n. 10
0
 public void UsingParametersForPowershell()
 {
     var runner = new ScriptRunner()
     .SetFile("_scriptWithParams.txt")
     .Run();
       var msg = runner.Logger.LoggedMessages.Find(s => s.Contains("Swonk"));
       msg.ShouldNotBeNull();
       msg.ShouldBeEqualTo("We have Foodadl and Swonk");
 }
Esempio n. 11
0
 public void SetupAllowsToSepcifyATarget()
 {
     var runner = new ScriptRunner()
     .SetFile("_scriptWithMessage.txt")
     .ExposeSetup(b=>b.Target="B")
     .Run();
       runner.Logged("Hello from Default").ShouldBeFalse();
       runner.Logged("Hello from B").ShouldBeTrue();
 }