public void VaultExecutionTest() { GrimoireScriptBlock script = TestHelper.GetSingleTestScript(); script.ExtractResult = new PatternRange() { Start = "", End = "" }; business.SaveScriptBlock(script).Wait(); GrimoireScriptBlock result = TestHelper.GetCreatedScript(config, "Test_Script.json"); result.Should().NotBeNull(); savedVault.Itens = new List <VaultItem>(); savedVault.Itens.Add(new VaultItem(true, "Key 1", "value 1")); savedVault.Itens.Add(new VaultItem(true, "Key 2", "value 2")); savedVault.Itens.Add(new VaultItem(true, "Key 3", "value 3")); business.LoadVault(); business.LoadScriptRunners().Wait(); ScriptResult scriptResult = business.ScriptRunners.First().Run().Result; scriptResult.Should().NotBeNull(); scriptResult.ResultType.Should().Be(ResultType.Success); scriptResult.FilteredResult.Should() .Contain("Single line multiple keys: value 1 - value 2") .And .Contain("Single key: value 3"); savedVault.Itens = new List <VaultItem>(); }
public void ScriptExecutionDefaultWarningTest() { GrimoireScriptBlock script = TestHelper.GetDefaultWarningTestScript(); business.SaveScriptBlock(script).Wait(); GrimoireScriptBlock result = TestHelper.GetCreatedScript(config, "Test_Script_Warning.json"); result.Should().NotBeNull(); business.LoadScriptRunners().Wait(); business.LoadVault().Wait(); ScriptResult scriptResult = business.ScriptRunners.First().Run().Result; scriptResult.Should().NotBeNull(); scriptResult.ResultType.Should().Be(ResultType.Warning); }
public void ScriptExecutionSoftErrorTest() { GrimoireScriptBlock script = TestHelper.GetSingleTestScript(); script.AlertLevel = AlertLevel.Error; script.SuccessPatern = "Soft Error"; business.SaveScriptBlock(script).Wait(); GrimoireScriptBlock result = TestHelper.GetCreatedScript(config, "Test_Script.json"); result.Should().NotBeNull(); business.LoadScriptRunners().Wait(); business.LoadVault().Wait(); ScriptResult scriptResult = business.ScriptRunners.First().Run().Result; scriptResult.Should().NotBeNull(); scriptResult.ResultType.Should().Be(ResultType.Error); }
public void ScriptExecutionSuccessTest() { GrimoireScriptBlock script = TestHelper.GetSingleTestScript(); business.SaveScriptBlock(script).Wait(); GrimoireScriptBlock result = TestHelper.GetCreatedScript(config, "Test_Script.json"); result.Should().NotBeNull(); business.LoadScriptRunners().Wait(); business.LoadVault().Wait(); ScriptResult scriptResult = business.ScriptRunners.First().Run().Result; scriptResult.Should().NotBeNull(); scriptResult.ResultType.Should().Be(ResultType.Success); scriptResult.FilteredResult.Should() .Contain("Result 1") .And .Contain("Result 2") .And .Contain("Result 3") .And .Contain("Result 4"); }