private void button1_Click(object sender, EventArgs e) { try { // Use calculator by simulating clicks. String digitOne = this.comboBox1.SelectedItem.ToString(); String digitTwo = this.comboBox2.SelectedItem.ToString(); String operation = this.comboBox3.SelectedItem.ToString(); WorkflowInvoker invoker = new WorkflowInvoker(ActivityXamlServices.Load(@"calc.uiwf")); var arguments = new Dictionary<string, object>(); arguments.Add("digitOne", digitOne); arguments.Add("digitTwo", digitTwo); arguments.Add("op", operation); IDictionary<string, object> outArgs = invoker.Invoke(arguments); String sResult = (String)outArgs["calcResult"]; this.textBox1.Text = sResult; } catch (Exception ex) { MessageBox.Show(this, "ERROR: " + ex.Message); } }
public void GetVersionTestElapsed() { // Initialise Instance var target = new TfsVersion { Action = TfsVersionAction.GetVersion, VersionTemplateFormat = "0.0.1000.0", StartDate = Convert.ToDateTime("1 Mar 2009"), VersionFormat = TfsVersionVersionFormat.Elapsed, UseUtcDate = true }; // Declare additional parameters var parameters = new Dictionary<string, object> { { "Major", "3" }, { "Minor", "1" }, }; // Create a WorkflowInvoker and add the IBuildDetail Extension WorkflowInvoker invoker = new WorkflowInvoker(target); IBuildDetail t = new MockIBuildDetail { BuildNumber = "MyBuild_" + DateTime.Now.ToString("yyyyMMdd") + ".2" }; t.BuildDefinition.Name = "MyBuild"; invoker.Extensions.Add(t); var actual = invoker.Invoke(parameters); // Test the result DateTime d = Convert.ToDateTime("1 Mar 2009"); TimeSpan ts = DateTime.Now - d; string days = ts.Days.ToString(); Assert.AreEqual("3.1.1" + days + ".2", actual["Version"].ToString()); }
public void Can_choose_to_list_a_file_added_in_the_build_log() { // arrange var monitor = new DebugMonitor("Adding file to check"); Trace.Listeners.Add(monitor); // create the activity var target = new StyleCop(); // create a parameter set Dictionary<string, object> args = new Dictionary<string, object> { { "SourceFiles", new string[] { @"TestFiles\FileWith6Errors.cs" } }, { "SettingsFile", @"TestFiles\AllSettingsEnabled.StyleCop" }, { "ShowOutput", true } }; // Create a WorkflowInvoker and add the IBuildDetail Extension WorkflowInvoker invoker = new WorkflowInvoker(target); // act var results = invoker.Invoke(args); // assert Assert.AreEqual(1, monitor.Writes); }
public void XmlFile_ValidateXmlTest() { // Arrange var target = new TfsBuildExtensions.Activities.Xml.Xml { Action = XmlAction.Transform }; // Define activity arguments var arguments = new Dictionary<string, object> { { "XmlText", @"<?xml version=""1.0""?> <catalog> <book id=""bk101""> <author>Gambardella, Matthew</author> <title>XML Developer's Guide</title> <genre>Computer</genre> <price>44.95</price> <publish_date>2000-10-01</publish_date> <description>An in-depth look at creating applications with XML.</description> </book> </catalog> " }, { "XslTransform", @"<xsl:transform version=""1.0"" xmlns:xsl=""http://www.w3.org/1999/XSL/Transform""/>" }, }; // Act WorkflowInvoker invoker = new WorkflowInvoker(target); var result = invoker.Invoke(arguments); // Assert Assert.IsFalse((bool)result["IsValid"]); }
public AsyncInvokeContext(object userState, WorkflowInvoker invoker) { this.UserState = userState; SynchronizationContext syncContext = SynchronizationContext.Current ?? System.Activities.WorkflowApplication.SynchronousSynchronizationContext.Value; this.Operation = new AsyncInvokeOperation(syncContext); this.Invoker = invoker; }
public void RunTestExtractAndConvertWorkflow_WhenRunningFullWorkflowShouldReplaceCorrectVersionNumbers() { // Create an instance of our test workflow var workflow = new TestExtractAndConvertWorkflowWrapper(); // Create the workflow run-time environment var workflowInvoker = new WorkflowInvoker(workflow); var minuteCount = (int)DateTime.Now.TimeOfDay.TotalMinutes; workflowInvoker.Extensions.Add(new BuildDetailStub(minuteCount)); // Set the workflow arguments workflow.ForceCreateVersion = true; workflow.AssemblyFileVersionReplacementPattern = "YYYY.MM.DD.B"; workflow.BuildNumber = "TestCodeActivity - 2_20110310.3"; workflow.AssemblyVersionReplacementPattern = "1.2.3.4"; workflow.FolderToSearch = TestContext.DeploymentDirectory; workflow.FileSearchPattern = "AssemblyInfo.*"; workflow.BuildNumberPrefix = 0; // Invoke the workflow and capture the outputs workflowInvoker.Invoke(); var file = TestContext.DataRow[0].ToString(); var versionName = TestContext.DataRow[1].ToString(); var fileData = File.ReadAllText(file); var regexPattern = string.Format(SearchPatternShell, versionName); var regex = new Regex(regexPattern); var matches = regex.Matches(fileData); Assert.AreEqual(1, matches.Count); }
public virtual WorkflowResult RunWorkflow(string workflowName, Dictionary<string, object> parameters, object[] extensions = null) { var retVal = new WorkflowResult(); parameters["ResultArgument"] = retVal; var activity = _activityProvider.GetWorkflowActivity(workflowName); if (activity == null) { throw new ArgumentException("Activity (workflow) not found by name: " + workflowName); } //var validationResults = ActivityValidationServices.Validate(activity); //if (validationResults.Errors.Count() == 0) //{ var invoker = new WorkflowInvoker(activity); if (extensions != null) { foreach (var ext in extensions) { invoker.Extensions.Add(ext); } } invoker.Invoke(parameters); //} //else //{ // throw new ValidationException(); //} //ActivityInvoker.Invoke(activity, parameters, extensions); return retVal; }
public void FileReplaceTest() { // Initialise Instance var target = new TfsBuildExtensions.Activities.FileSystem.File { Action = FileAction.Replace, RegexPattern = "Michael", Replacement = "Mike" }; // Create a temp file and write some dummy attribute to it FileInfo f = new FileInfo(System.IO.Path.GetTempFileName()); System.IO.File.WriteAllLines(f.FullName, new[] { "Michael" }); // Declare additional parameters var parameters = new Dictionary<string, object> { { "Files", new[] { f.FullName } }, }; // Create a WorkflowInvoker and add the IBuildDetail Extension WorkflowInvoker invoker = new WorkflowInvoker(target); var actual = invoker.Invoke(parameters); // read the updated file back. using (System.IO.StreamReader file = new System.IO.StreamReader(f.FullName)) { // Test the result Assert.AreEqual("Mike", file.ReadLine()); } }
public void Check_a_file_with_no_issues_and_defaults_rules_will_not_create_a_text_logfile() { // arrange var fileName = "LogFile.Txt"; System.IO.File.Delete(fileName); // create the activity var target = new StyleCop(); // create a parameter set Dictionary<string, object> args = new Dictionary<string, object> { { "SourceFiles", new string[] { @"TestFiles\FileWith0Errors.cs" } }, { "SettingsFile", @"TestFiles\AllSettingsEnabled.StyleCop" }, { "LogFile", fileName } }; // Create a WorkflowInvoker and add the IBuildDetail Extension WorkflowInvoker invoker = new WorkflowInvoker(target); // act var results = invoker.Invoke(args); // assert Assert.IsFalse(System.IO.File.Exists(fileName)); }
public void Extra_rules_can_loaded_from_a_directory_that_is_not_a_sub_directory_of_current_location() { // arrange var resultsFile = "StyleCop.Cache"; System.IO.File.Delete(resultsFile); // create the activity var target = new StyleCop(); // create a parameter set Dictionary<string, object> args = new Dictionary<string, object> { { "SourceFiles", new string[] { @"TestFiles\FileWith6Errors.cs" } }, { "SettingsFile", @"TestFiles\AllSettingsEnabled.StyleCop" }, { "AdditionalAddInPaths", new string[] { @"..\Activities.StyleCop.Tests\AddIns" } }, // the directory cannot be a sub directory of current as this is automatically scanned }; // Create a WorkflowInvoker and add the IBuildDetail Extension WorkflowInvoker invoker = new WorkflowInvoker(target); // act var results = invoker.Invoke(args); // assert Assert.AreEqual(false, results["Succeeded"]); Assert.AreEqual(7, results["ViolationCount"]); // 6 core violations + the extra custom one }
public void Setting_the_cache_option_causes_the_results_to_be_cached_in_the_default_directory() { // arrange var resultsFile = "StyleCop.Cache"; System.IO.File.Delete(resultsFile); // create the activity var target = new StyleCop(); // create a parameter set Dictionary<string, object> args = new Dictionary<string, object> { { "SourceFiles", new string[] { @"TestFiles\FileWith6Errors.cs" } }, { "SettingsFile", @"TestFiles\AllSettingsEnabled.StyleCop" }, { "CacheResults", true }, }; // Create a WorkflowInvoker and add the IBuildDetail Extension WorkflowInvoker invoker = new WorkflowInvoker(target); // act var results = invoker.Invoke(args); // assert Assert.IsTrue(System.IO.File.Exists(resultsFile)); var document = new XPathDocument(resultsFile); var nav = document.CreateNavigator(); Assert.AreEqual(6d, nav.Evaluate("count(/stylecopresultscache/sourcecode/violations/violation)")); }
public void ConvertVersionPattern_WhenUsingBuildPrefixShouldConvertIntoProperVersion() { var totalHours = (int)DateTime.Now.TimeOfDay.TotalHours; const int prefixVal = 100; // Create an instance of our test workflow var workflow = new Tests.ConvertVersionPatternTestWorkflow(); // Create the workflow run-time environment var workflowInvoker = new WorkflowInvoker(workflow); workflowInvoker.Extensions.Add(new BuildDetailStub(totalHours)); workflow.VersionPattern = "1.0.0.B"; workflow.BuildNumberPrefix = prefixVal; // Invoke the workflow and capture the outputs var outputs = workflowInvoker.Invoke(); // Retrieve the out arguments to do our verification var convertedVersionNumber = (String)outputs["ConvertedVersionNumber"]; // Verify that we captured the version component of the build number Assert.AreEqual(string.Format("1.0.0.{0}", totalHours + prefixVal), convertedVersionNumber); }
public void Not_setting_the_cache_option_causes_the_results_to_not_be_cached_in_the_default_directory() { // arrange var resultsFile = "StyleCop.Cache"; System.IO.File.Delete(resultsFile); // create the activity var target = new StyleCop(); // create a parameter set Dictionary<string, object> args = new Dictionary<string, object> { { "SourceFiles", new string[] { @"TestFiles\FileWith6Errors.cs" } }, { "SettingsFile", @"TestFiles\AllSettingsEnabled.StyleCop" }, { "CacheResults", false }, }; // Create a WorkflowInvoker and add the IBuildDetail Extension WorkflowInvoker invoker = new WorkflowInvoker(target); // act var results = invoker.Invoke(args); // assert Assert.IsFalse(System.IO.File.Exists(resultsFile)); }
public void EmailTest() { // Initialise Instance var target = new TfsBuildExtensions.Activities.Communication.Email { Action = EmailAction.Send, EnableSsl = true, FailBuildOnError = false, Format = "HTML", LogExceptionStack = true, MailFrom = "YOUREMAIL", Port = 587, Priority = "Normal", SmtpServer = "smtp.gmail.com", Subject = "hi 2", TreatWarningsAsErrors = false, UseDefaultCredentials = false, UserName = "******", UserPassword = "******" }; // Declare additional parameters var parameters = new Dictionary<string, object> { { "MailTo", new[] { "YOURRECIPIENT" } }, }; // Create a WorkflowInvoker and add the IBuildDetail Extension WorkflowInvoker invoker = new WorkflowInvoker(target); var actual = invoker.Invoke(parameters); // note this unit test is for debugging rather than testing so just return a true assertion Assert.IsTrue(1 == 1); }
public override bool Execute() { var url = GetCollectionUri(); var binDir = GetBinariesDirectory(); var teamBuildWorkflowAssemblyPath = GetTeamBuildWorkflowAssemblyDirectory(); var pdbStrToolDirectory = GetPdbStrToolDirectory(); LoadBuildWorkflowAssembly(teamBuildWorkflowAssemblyPath); LoadDbgHelpLibrary(); ExtractPdbSrcExe(pdbStrToolDirectory); var collection = TfsTeamProjectCollectionFactory.GetTeamProjectCollection(new Uri(url)); var inputParameters = new Dictionary<string, object> { { "BinariesDirectory", binDir } }; using (new IndexSourcesToolPathOverrideScope(pdbStrToolDirectory)) { var workflow = new RunIndexSources(); var invoker = new WorkflowInvoker(workflow); invoker.Extensions.Add(collection); invoker.Invoke(inputParameters); } return true; }
public void SmsTest() { // Initialise Instance var target = new TfsBuildExtensions.Activities.Communication.Sms { Action = SmsAction.Send, From = "YOUREMAIL", Body = "YOURBODY", AccountSid = "YOURSID", AuthToken = "YOURTOKEN" }; // Declare additional parameters var parameters = new Dictionary<string, object> { { "To", new[] { "YOURRECIPIENT" } }, }; // Create a WorkflowInvoker and add the IBuildDetail Extension WorkflowInvoker invoker = new WorkflowInvoker(target); var actual = invoker.Invoke(parameters); // note this unit test is for debugging rather than testing so just return a true assertion Assert.IsTrue(1 == 1); }
/// <summary> /// The Main program /// </summary> private static void Main() { var invoker = new WorkflowInvoker(Workflow1Definition); invoker.Extensions.Add(new WriteLineTracker()); invoker.Extensions.Add(new FileTracker("Tracking.txt")); invoker.Invoke(); }
public void RunWorkflow() { var wf = new WorkflowInvoker( new CraigslistLeadCollector() ); var result = wf.Invoke(); Assert.IsInstanceOfType( result, typeof( Dictionary<string, object> ) ); var element = result.ElementAt( 0 ).Value as XElement; element.Save("c:/temp/craigslistResponse.xml"); }
public void Create() { //CreateInterviewWorkflow2 ciw = new CreateInterviewWorkflow2(); //ciw.Run(); CreateInterviewWorkflow ciw = new CreateInterviewWorkflow(); WorkflowInvoker wfi = new WorkflowInvoker(ciw); wfi.Invoke(); }
private void Because() { var checkLoanEligibilityWorkflow = new WorkflowWebApiExample.Workflows.CheckLoanEligibility(); var workflowInvoker = new WorkflowInvoker(checkLoanEligibilityWorkflow); var InputArguments = new Dictionary<string, object>(); InputArguments.Add("loan", _loan); var resultDictionary = workflowInvoker.Invoke(InputArguments); _result = (bool)resultDictionary["approved"]; }
public void NotifyCompletedWithNoDelegateShouldDoNothing() { var model = CountModelFactory.CreateModel(); var invoker = new WorkflowInvoker(new NotifyCountCompleted()); invoker.Extensions.Add(model); invoker.Invoke(); // No exception is success }
private void Because() { var validateLoanIsCompleteActivity = new WorkflowWebApiExample.CodeActivities.ValidateLoanIsComplete(); var workflowInvoker = new WorkflowInvoker(validateLoanIsCompleteActivity); var InputArguments = new Dictionary<string, object>(); InputArguments.Add("Loan", _loan); var resultDictionary = workflowInvoker.Invoke(InputArguments); _result = (bool)resultDictionary["Valid"]; }
public void ShouldStartInnerWorkflow() { var innerWorkflow = new Mock<IWorkflow<string>>(); innerWorkflow.Setup(wf => wf.Start("red")).Returns("dd"); var invoker = new WorkflowInvoker<string>(innerWorkflow.Object); invoker.Execute("red"); innerWorkflow.VerifyAll(); }
public void ValidateRegex_Test_NullContext_ExpectedException() { //ARRANGE //set matchpattern to nanp format of xxx-xxx-xxxx string matchPattern = @"^[2-9]\d{2}-\d{3}-\d{4}$"; //set string to validate to a valid phone number string stringToValidate = "334-867-5309"; //create our mocks var serviceMock = new Mock<IOrganizationService>(); var factoryMock = new Mock<IOrganizationServiceFactory>(); var tracingServiceMock = new Mock<ITracingService>(); var workflowContextMock = new Mock<IWorkflowContext>(); //set up a mock service to act like the CRM organization service IOrganizationService service = serviceMock.Object; //set up a mock workflowcontext var workflowUserId = Guid.NewGuid(); var workflowCorrelationId = Guid.NewGuid(); var workflowInitiatingUserId = Guid.NewGuid(); workflowContextMock.Setup(t => t.InitiatingUserId).Returns(workflowInitiatingUserId); workflowContextMock.Setup(t => t.CorrelationId).Returns(workflowCorrelationId); workflowContextMock.Setup(t => t.UserId).Returns(workflowUserId); var workflowContext = workflowContextMock.Object; //set up a mock tracingservice - will write output to console for now. maybe should store somewhere and read for asserts later? tracingServiceMock.Setup(t => t.Trace(It.IsAny<string>(), It.IsAny<object[]>())).Callback<string, object[]>((t1, t2) => Console.WriteLine(t1, t2)); var tracingService = tracingServiceMock.Object; //set up a mock servicefactory factoryMock.Setup(t => t.CreateOrganizationService(It.IsAny<Guid>())).Returns(service); var factory = factoryMock.Object; //get new validateregex object ValidateRegex valRegex = new ValidateRegex(); var invoker = new WorkflowInvoker(valRegex); invoker.Extensions.Add<ITracingService>(() => tracingService); //below line commented out to generate exception //invoker.Extensions.Add<IWorkflowContext>(() => workflowContext); invoker.Extensions.Add<IOrganizationServiceFactory>(() => factory); var inputs = new Dictionary<string, object> { { "MatchPattern", matchPattern}, { "StringToValidate", stringToValidate } }; //ACT (assertion is implied) invoker.Invoke(inputs); }
public void XmlUpdateElementTests_WhenEmptyParametersArePassedInShouldThrowAppropriateException() { var testFileName = TestContext.DataRow["FilePath"].ToString(); var xmlNamespace = TestContext.DataRow["XmlNamespace"].ToString(); var xpathExpression = TestContext.DataRow["XPathExpression"].ToString(); var xmlNamespacePrefix = TestContext.DataRow["XmlNamespacePrefix"].ToString(); var newVersionNumber = TestContext.DataRow["ReplacementValue"].ToString(); var expectedResult = bool.Parse(TestContext.DataRow["ExpectedResult"].ToString()); var expectedException = TestContext.DataRow["ExpectedException"].ToString(); if (testFileName == "FileNotFound") { testFileName = "missingfilename.xml"; } else if (!string.IsNullOrEmpty(testFileName)) { var exeptionTestFile = Path.Combine(TestContext.DeploymentDirectory, "ExceptionTestFile.xml"); if (File.Exists(exeptionTestFile)) { File.Delete(exeptionTestFile); } testFileName = Path.Combine(TestContext.DeploymentDirectory, testFileName); File.Copy(testFileName, exeptionTestFile); //testFileName = exeptionTestFile; } // Create an instance of our test workflow var workflow = new CallXmlUpdateElementWorkflow(); // Create the workflow run-time environment var workflowInvoker = new WorkflowInvoker(workflow); // Set the workflow arguments workflow.FilePath = testFileName; workflow.ReplacementValue = newVersionNumber; workflow.XmlNamespace = xmlNamespace; workflow.XmlNamespacePrefix = xmlNamespacePrefix; workflow.XPathExpression = xpathExpression; try { workflowInvoker.Invoke(); Assert.IsTrue(expectedResult, "Should have failed"); } catch (Exception exception) { var exceptionName = exception.GetType().ToString(); Assert.IsTrue(exceptionName.EndsWith("." + expectedException), "Should have thrown an exception"); Assert.IsFalse(expectedResult, "Should have succeeded but an exception was thrown: " + exception.Message); } }
public void ReplaceVersionInFile_WhenReplacingVersionShouldReplaceCorrectVersionNumber() { // Get the data from the XML file var filename = TestContext.DataRow["filename"].ToString(); var version = TestContext.DataRow["version"].ToString(); var versionType = (VersionTypeOptions) Enum.Parse(typeof(VersionTypeOptions), TestContext.DataRow["versionType"].ToString()); var forceCreate = bool.Parse(TestContext.DataRow["forceCreate"].ToString()); var expectedResult = bool.Parse(TestContext.DataRow["expectedResult"].ToString()); var createVersionTypes = TestContext.DataRow["createVersionTypes"].ToString(); // Convert the enum type into a string var versionName = versionType.ToString(); var pattern = string.Format(SearchPatternShell, versionName, version); var regexPattern = pattern; // Create an instance of our test workflow var workflow = new Tests.TestReplaceVersionInFileWorkflow(); // Create the workflow run-time environment var workflowInvoker = new WorkflowInvoker(workflow); // Create a unique filename to store the test data file var rowNumber = TestContext.DataRow.Table.Rows.IndexOf(TestContext.DataRow); var testFilename = string.Format("{0}-{1}-{2}-{3}{4}", rowNumber, Path.GetFileNameWithoutExtension(filename), versionName, version, Path.GetExtension(filename)); CreateTestFile(filename, testFilename, createVersionTypes); // Set the workflow arguments workflow.FilePath = testFilename; workflow.VersionType = VersionTypeOptions.AssemblyVersion; workflow.ForceCreate = forceCreate; workflow.ReplacementVersion = version; // Invoke the workflow and capture the outputs workflowInvoker.Invoke(); // Verify using RegEx var fileData = File.ReadAllText(testFilename); var regex = new Regex(regexPattern); var matches = regex.Matches(fileData); // Assert the result based on expected results: should we find the version or not if (expectedResult) { Assert.IsTrue(matches.Count > 0, string.Format("Test Failed: File: {0}", testFilename)); } else { Assert.AreEqual(0, matches.Count, string.Format("Test Failed: File: {0}", testFilename) ); } }
//Run workflow logic to see if the loan application is valid. public bool CheckLoanEligibility(Loan loan) { var checkLoanEligibility = new Workflows.CheckLoanEligibility(); var workflow = new WorkflowInvoker(checkLoanEligibility); var InputArguments = new Dictionary<string, object>(); InputArguments.Add("loan", loan); var resultDictionary = workflow.Invoke(InputArguments); var result = (bool)resultDictionary["approved"]; return result; }
public void DevEnvNoPlatformTest() { // Initialise Instance var target = new TfsBuildExtensions.Activities.VisualStudio.VSDevEnv { Action = VSDevEnvAction.Rebuild, Configuration = "Debug", FilePath = @"C:\Users\Michael\Documents\visual studio 2012\Projects\ConsoleApplication1\ConsoleApplication1.sln", OutputFile=@"D:\a\log.txt", Platform = "AnyCPU"}; // Create a WorkflowInvoker and add the IBuildDetail Extension WorkflowInvoker invoker = new WorkflowInvoker(target); var actual = invoker.Invoke(); // note no result here... this test s for manual testing purposes }
// Before running this sample, please add UiPath package from NuGet // You can find more info about this here : https://github.com/Deskover/UiPath/wiki/Development-with-API#wiki-Using_NuGet_package_manager static void Main(string[] args) { var workflowText = Properties.Resources.Workflow; var stream = new MemoryStream(); var writer = new StreamWriter(stream); writer.Write(workflowText); writer.Flush(); stream.Position = 0; var invoker = new WorkflowInvoker(ActivityXamlServices.Load(stream)); invoker.Invoke(); }
public void TestMethod1() { WorkflowInvoker invoker = new WorkflowInvoker(new CodeActivity1()); var input = new Dictionary<string, object> { { "Text", "Goedemorgen" } }; var result = invoker.Invoke(input); Assert.AreEqual("Goedemorgen workflow", result["Output"]); }
public void SetTheCorrectChangeSource(ChangeSource source) { IDictionary <string, object> inputs = new Dictionary <string, object> { { "Container", _container }, { "Source", source } }; WorkflowInvoker.Invoke(new GetChanges(), inputs); _mockRepo.Verify(r => r.All <CustomerAudit>()); Assert.AreEqual(source, _changes[0].Source); Assert.AreEqual(source, _changes[1].Source); }
static void Main(string[] args) { ActivityXamlServicesSettings settings = new ActivityXamlServicesSettings { CompileExpressions = true }; Activity workflow = ActivityXamlServices.Load("Workflow1.xaml", settings); WorkflowInvoker.Invoke(workflow); Console.WriteLine("Press <enter> to exit" + System.Environment.CurrentDirectory); Console.ReadLine(); }
static void Main() { Activity mySequence = CreateMySequence(); WorkflowInvoker.Invoke(mySequence); Activity myWhile = CreateMyWhile(); WorkflowInvoker.Invoke(myWhile); Console.WriteLine("Press [Enter] to exit."); Console.ReadLine(); }
public void ExecuteCreateWorkspaceTest() { var activity = new CreateWorkspace(); activity.LocalPath = @"C:\TFSUpload"; activity.ServerPath = "$/Markus_Test/UploadTest2"; activity.TFSCollectionUrl = new InArgument <Uri>(new LambdaValue <Uri>((env) => (new Uri("http://localhost:8080/tfs/DefaultCollection")))); activity.WorkspaceName = "TestMethodWorkspace"; activity.WorkspaceComment = "TestMethodWorkspace"; var output = WorkflowInvoker.Invoke(activity); Assert.IsNotNull(output["Workspace"]); }
public void WhenFileIsValid_ColumnNameIsReadCorrectly(string excelPath, int position, string expectedColumnName) { var parameters = new Dictionary <string, object> { { nameof(ReadColumnNameByColumnIndex.WorkbookPath), excelPath }, { nameof(ReadColumnNameByColumnIndex.SheetIndex), position }, }; var properties = WorkflowInvoker.Invoke(_activity, parameters); var sheetName = (string)properties[nameof(ReadColumnNameByColumnIndex.SheetName)]; sheetName.Should().Be(expectedColumnName); }
public void TestInvokeStaticMethod() { var a = new InvokeMethod <int>() { MethodName = "GetSomething", TargetType = this.GetType(), }; var r = WorkflowInvoker.Invoke(a);//method GetSomething() run in the same thread System.Diagnostics.Debug.WriteLine("Something invoke"); Assert.Equal(System.Threading.Thread.CurrentThread.ManagedThreadId, r); }
private IDictionary <string, object> ProcessCommand(Command cmd, Dictionary <string, object> input, CustomBookmark bm) { input = input ?? new Dictionary <string, object> { }; input["BookmarkHistory"] = history; input["Action"] = cmd; input["Bookmark"] = bm; IDictionary <string, object> output = WorkflowInvoker.Invoke(wizard, input); history = output["BookmarkHistory"] as List <CustomBookmark>; return(output); }
public void Test_UpdateIsFalse_When_TypeDoesNotHaveIntegratedInField() { using (var context = ShimsContext.Create()) { var args = GetWorkflowArgs(false, true); var activity = new UpdateWorkItem(); IDictionary <string, object> outputs; var result = WorkflowInvoker.Invoke(activity, args, out outputs, TimeSpan.FromMinutes(1)); Assert.IsFalse(result); Assert.IsTrue(outputs["WarningMessage"].ToString().Contains("TF42093")); } }
public void WriteToConsole() { var workflow1 = new Sequence() { DisplayName = "Hello World Sequence" }; workflow1.Activities.Add(new WriteLine() { Text = "Hello World!", DisplayName = "Display greeting" }); WorkflowInvoker.Invoke(workflow1); }
public void ExecuteTest() { // Initialise Instance var target = new Hello { Message = "World" }; // Invoke the Workflow var actual = WorkflowInvoker.Invoke(target); // Test the result Assert.AreEqual("Hello World", actual); }
private void RunStep() { Dictionary <String, Object> parametros = new Dictionary <String, Object>(); parametros.Add("Game", game); parametros.Add("Player", playerA ? game.PlayerA : game.PlayerB); WorkflowInvoker wfinvoker = new WorkflowInvoker(new TurnFlow()); wfinvoker.Invoke(parametros); playerA = !playerA; }
private static void RunWorkflow(Activity workflow, Int32 itemId, Int32 quantity) { IDictionary <String, Object> output = WorkflowInvoker.Invoke( workflow, new Dictionary <string, object> { { "ArgItemId", itemId }, { "ArgQuantity", quantity } }); Console.WriteLine("Item: {0} Requested: {1} Found: {2}", itemId, quantity, output["ArgQuantityFound"]); }
public void Run_WaitForExitWith0Timeout() { var vbsInvoke = new RunProcessWithTimeoutActivity { FileName = @"perl.exe", Arguments = @"..\..\TestScripts\PerlConfigurableDurationStdOutput.pls 3", WaitForExit = true, KillAtTimeout = true, CaptureOutput = true }; var argEx = Assert.ThrowsException <ArgumentException>(() => WorkflowInvoker.Invoke(vbsInvoke)); }
// WorkflowInvoker.Extensions Property // Excerpts from Custom Tracking Sample static void snippet40() { // to get to compile, this is not a functional running snippet object customTrackingParticipant = new object(); //<snippet40> WorkflowInvoker invoker = new WorkflowInvoker(BuildSampleWorkflow()); invoker.Extensions.Add(customTrackingParticipant); invoker.Invoke(); //</snippet40> }
public void CreateTheCorrectRepositoryType(ChangeSource source) { _change.Source = source; WorkflowInvoker.Invoke(new SyncChange(), _inputs); if (source == ChangeSource.MSSQL) { _nhRepo.Verify(r => r.Create()); } else { _efRepo.Verify(r => r.Create()); } }
static void Snippet2() { //<snippet2> Activity wf = new WriteLine { Text = "Hello World." }; WorkflowInvoker invoker = new WorkflowInvoker(wf); invoker.Invoke(); //</snippet2> }
public void TestParameterActivity() { var activity = new SoundExCustomActivity(); var input = new Dictionary <string, object> { { "Phrase", "Rubin" } }; var output = WorkflowInvoker.Invoke(activity, input); Assert.AreEqual(output["Code"], "R150"); }
static public void TestWorkflow() { ActivityXamlServicesSettings settings = new ActivityXamlServicesSettings { CompileExpressions = true }; Activity workflow = ActivityXamlServices.Load("ExcelActivityTest.xaml", settings); WorkflowInvoker.Invoke(workflow); Console.WriteLine("Press <enter> to exit"); Console.ReadLine(); }
public IDictionary <string, object> Execute(Activity activity) { // Workflow Invoker var invoker = new WorkflowInvoker(activity); invoker.Extensions.Add <ITracingService>(() => TracingService); invoker.Extensions.Add <IOrganizationServiceFactory>(() => Factory); invoker.Extensions.Add <IWorkflowContext>(() => WorkflowContext); A.CallTo(() => WorkflowContext.PrimaryEntityId).Returns(Target.Id); var output = invoker.Invoke(Inputs); return(output); }
// Retrieves the current date using a DbQueryScalar static void GetCurrentDate() { Activity dbSelectCount = new DbQueryScalar <DateTime>() { ProviderName = providerInvariantName, ConnectionString = connectionString, Sql = "SELECT GetDate()" }; IDictionary <string, object> results = WorkflowInvoker.Invoke(dbSelectCount); Console.WriteLine("Result: {0}", results["Result"].ToString()); }
public void DevEnvNoPlatformTest() { // Initialise Instance var target = new TfsBuildExtensions.Activities.VisualStudio.VSDevEnv { Action = VSDevEnvAction.Rebuild, Configuration = "Debug", FilePath = @"C:\Users\Michael\Documents\visual studio 2012\Projects\ConsoleApplication1\ConsoleApplication1.sln", OutputFile = @"D:\a\log.txt", Platform = "AnyCPU" }; // Create a WorkflowInvoker and add the IBuildDetail Extension WorkflowInvoker invoker = new WorkflowInvoker(target); var actual = invoker.Invoke(); // note no result here... this test s for manual testing purposes }
public ActionResult FindBMI(BMI model) { var result = WorkflowInvoker.Invoke(new BMIRuleEngine.Workflow1(), new Dictionary <string, object> { { "BMIInput", model.BMIValue } }); model.Recommendation = result["Recomendetion"] as String; TempData["wfResult"] = model; return(RedirectToAction("ShowResult")); }
public void TestPlusWithDefaultValue() { var a = new Plus() { Y = 2, //X not assigned, thus will have the default value 0 when being invoked. }; Assert.Null(a.X); var dic = WorkflowInvoker.Invoke(a); Assert.Equal(2, (int)dic["Z"]); Assert.NotNull(a.X); }
public void Default() { var dt = DataTableHelper.CreateDataTable <string>(3, new[] { new object[] { "A", 10, true } }); var row = dt.Rows[0]; var result = WorkflowInvoker.Invoke(new DataRowToDictionary(), GetArgs(row)); Assert.AreEqual(row[0], result["Col0"]); Assert.AreEqual(row[1], result["Col1"]); Assert.AreEqual(row[2], result["Col2"]); }
public void TestMultiplyGenericThrows2() { Assert.Throws <InvalidWorkflowException>(() => { var a = new System.Activities.Expressions.Multiply <int, long, long>() { Left = 100, Right = 200L, }; var r = WorkflowInvoker.Invoke(a); }); }
public void Default(bool expression) { try { WorkflowInvoker.Invoke(new CheckPoint(), GetArgs(expression, new Exception("The expression is false"))); Assert.IsTrue(expression); } catch (Exception e) { Assert.IsFalse(expression); Assert.AreEqual("The expression is false", e.Message); } }
public void SSHConnectScopeWithoutSSHRunCommandInside() { var connectScopeActivity = new SSHConnectScope { Host = Test_SSHHost, Username = Test_SSHUsername, Password = new InArgument <SecureString>(value => new NetworkCredential("", Test_SSHPassword).SecurePassword), Port = 22, TimeoutMS = 3000 }; var output = WorkflowInvoker.Invoke(connectScopeActivity); }
private void btnRequest_Click(object sender, EventArgs e) { CustomerInterface.CustomerInfo customerInfo = new CustomerInterface.CustomerInfo(); customerInfo.IP = new InArgument <string>("130.185.76.7"); customerInfo.Port = new InArgument <int>(9020); customerInfo.Database = new InArgument <string>("TESTANDRIOD"); customerInfo.Version = new InArgument <string>("V3.0"); customerInfo.UserId = new InArgument <int>(9); customerInfo.FPId = new InArgument <int>(1); customerInfo.ServiceKey = new InArgument <string>("1234"); WorkflowInvoker.Invoke <string>(customerInfo); }
public void Run_FilenameDoesNotExist() { var vbsInvoke = new RunProcessWithTimeoutActivity { FileName = @"..\..\TestScripts\NonExistentFile.bat", WaitForExit = true, WaitForExitTimeout = 10000, KillAtTimeout = true, CaptureOutput = true }; var argumentException = Assert.ThrowsException <ArgumentException>(() => WorkflowInvoker.Invoke(vbsInvoke)); }