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 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 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 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); }
/// <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 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 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 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 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 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); }
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 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 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 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 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()); }
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 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"); }
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"]; }
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 }
public void Create() { //CreateInterviewWorkflow2 ciw = new CreateInterviewWorkflow2(); //ciw.Run(); CreateInterviewWorkflow ciw = new CreateInterviewWorkflow(); WorkflowInvoker wfi = new WorkflowInvoker(ciw); wfi.Invoke(); }
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 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 }
//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; }
// 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 ZipPathTest() { // Initialise Instance var target = new Zip { Action = ZipAction.Create, CompressPath = @"D:\Projects\teambuild2010contrib\MAIN\Source\Activities.Tests\Compression\TestFiles", ZipFileName = @"D:\a\newZipByPath.zip" }; // Create a WorkflowInvoker and add the IBuildDetail Extension WorkflowInvoker invoker = new WorkflowInvoker(target); var actual = invoker.Invoke(); // Test the result Assert.IsTrue(System.IO.File.Exists(@"d:\a\newZipByPath.zip")); }
public void NotifyCompletedShouldNotify() { var model = CountModelFactory.CreateModel(); var completeNotified = false; model.CountCompleted = () => completeNotified = true; var invoker = new WorkflowInvoker(new NotifyCountCompleted()); invoker.Extensions.Add(model); invoker.Invoke(); Assert.IsTrue(completeNotified); }
public void CompositeActivityInjectedByUnityExtension() { _container.AddNewExtension<WorkflowExtension>(); var activity = _container.Resolve<CompositeActivity2>(); var wfInvoker = new WorkflowInvoker(activity); var results = wfInvoker.Invoke(); Assert.AreEqual(45, (int)results["CompositeResult"]); }
public static void InvokeActivity(Activity activity, TimeSpan timeout) { //Log.Info("Using ActivityInvoke()"); WorkflowInvoker.Invoke(activity, timeout); }
public static IDictionary <string, object> InvokeActivity(Activity activity, IDictionary <string, object> dictionary, TimeSpan timeout) { return(WorkflowInvoker.Invoke(activity, dictionary, timeout)); }
static void Main(string[] args) { WorkflowInvoker.Invoke(new DurableDuplexClient()); }
static void Main(string[] args) { Activity workflow1 = new Workflow1(); WorkflowInvoker.Invoke(InvokeMethodActivity.CreateInvokeMethodWf()); }
static void Main(string[] args) { WorkflowInvoker.Invoke(new MyWorkflow()); Console.Read(); }
static void Main(string[] args) { WorkflowInvoker.Invoke(new Flowchart()); }
/// <summary> /// ć¤ć³ćććÆć¹ä½ęå¦ēćäøå®ééć§č”ćć¾ć /// </summary> /// <param name="sender"></param> /// <param name="e"></param> async void OnIndexTimerElapsed(object sender, System.Timers.ElapsedEventArgs e) { if (this.IsSuspendIndex) { return; // ćµć¹ćć³ćęćÆć¤ć³ćććÆć¹ēęå¦ēćÆć¹ććććć } // ć¤ć³ćććÆć¹ēęå¦ēäøćÆććć®ć”ć½ćććå¼ć³åŗććæć¤ćć¼ćÆåę¢ćć¦ććć¾ćć var timer = sender as System.Timers.Timer; timer.Enabled = false; LOG.Info("ćæć¤ćć¼å¦ēć®å®č”"); // ćć£ć¬ćÆććŖåé¤ć¤ćć³ććēŗēćć¦ććå “åć // åé¤ćććć£ć¬ćÆććŖć«å«ć¾ćć¦ćććć”ć¤ć«ććåé¤ćććć¹ććč¦ć¤ćåŗćć¦åé¤å¦ēćč”ććć„ć¼ć«čæ½å ćć lock (sameDirectoryOperation_Locker) { if (sameDirectoryOperation_Name != "") { sameDirectoryOperation_Name = ""; var relativeDirPath = _Workspace.TrimWorekspacePath(sameDirectoryOperation_FullPath, false); using (var dbc = new AppDbContext()) { var repo = new FileMappingInfoRepository(dbc); foreach (var prop in repo.FindBy(p => p.MappingFilePath.StartsWith(relativeDirPath))) { var fileUpdateQueueItem = new FileUpdateQueueItem { Target = new FileInfo(Path.Combine(_Workspace.WorkspacePath, prop.MappingFilePath + ".aclgene")) }; fileUpdateQueueItem.Recents.Add(new RecentInfo { EventType = WatcherChangeTypes.Deleted }); _UpdatesWatchFiles.AddOrUpdate(prop.MappingFilePath, fileUpdateQueueItem, (_key, _value) => fileUpdateQueueItem); } } } } // foreach (var @pair in _UpdatesWatchFiles.ToList()) { // ęå¾ć®ćć”ć¤ć«ē£č¦ē¶ę ćććäøå®ęéēµéćć¦ććå “åć®ćæå¦ēćč”ćć var @diff = DateTime.Now - @pair.Value.LastUpdate; if (@diff.Seconds >= 10) // 10ē§ 仄äøēµé { FileUpdateQueueItem item; // work if (_UpdatesWatchFiles.TryRemove(@pair.Key, out item)) { var @lastItem = item.Recents.LastOrDefault(); // NOTE: UpdateVirtualSpaceFlowćÆć¼ćÆććć¼ćå¼ć³åŗć LOG.InfoFormat("ćÆć¼ćÆććć¼å®č” [{1}] åÆ¾č±”ćć”ć¤ć«ćć¹={0}", item.Target.FullName, @lastItem.EventType); // ćÆć¼ćÆććć¼å¦ēäøć«ēŗēćććć”ć¤ć«ę“ę°ć¤ćć³ćć«ćććę“ę°ćć„ć¼ć«é ē®ćčæ½å ććć¦ćć¾ćććØćé²ćććć // å¦ēäøć®ćć”ć¤ć«ćę“ę°ćć„ć¼ććé¤å¤ććććć®é¤å¤ćŖć¹ćć«ćå¦ēäøć®ćć”ć¤ć«ćčæ½å ććć // // ā»å¦ēäøć®ćć”ć¤ć«ćACLćć”ć¤ć«ä»„å¤ć®å “åćåÆ¾č±”ćć”ć¤ć«ć®ACLćć”ć¤ć«åćé¤å¤ćŖć¹ćć«čæ½å ćć _IgnoreUpdateFiles.Enqueue(item.Target.FullName); if (item.Target.Extension != ".aclgene") { _IgnoreUpdateFiles.Enqueue(item.Target.FullName + ".aclgene"); } try { using (var dbc = new AppDbContext()) { var workspace = WorkspaceRepository.Load(dbc, _Workspace.Id); var workflow = new WorkflowInvoker(new UpdateVirtualSpaceAppFlow()); workflow.Extensions.Add(new WorkflowExtention(dbc)); var pstack = new ParameterStack(); // å¦ēåÆ¾č±”ć®ćć”ć¤ć«ćACLćć”ć¤ć«ććē©ēćć”ć¤ć«ćć§å¦ēćåćåćć¾ć // ā ACLćć”ć¤ć«ć®å “å // ćŖćć¼ć ę“ę°ć¤ćć³ćć«åƾåæćć¾ćć // ā ē©ēćć”ć¤ć«ć®å “å // ćŖćć¼ć ę“ę°ć¤ćć³ćććUPDATEć¤ćć³ććØćć¦å¦ēćć¾ćć if (item.Target.Extension == ".aclgene") { var fileNameWithputExtension = item.Target.Name.Replace(item.Target.Extension, ""); switch (@lastItem.EventType) { case WatcherChangeTypes.Renamed: pstack.SetValue("Event", Mogami.Core.Constructions.UpdateVirtualStatusEventType.RENAME); pstack.SetValue(ActivityParameterStack.WORKSPACE_FILEINFO, item.Target); pstack.SetValue(ActivityParameterStack.WORKSPACE_FILEPATH, item.Target.Name); // ćŖćć¼ć å¾ć®ćć”ć¤ć«å pstack.SetValue(ActivityParameterStack.WORKSPACE, workspace); var results_renamed = workflow.Invoke(new Dictionary <string, object> { { "ParameterStack", pstack }, //{"EventType", UpdateVirtualStatusEventType.RENAME}, //{"Target", item.Target}, //{"BeforeRenameName",item.OldRenameNamePath}, //{"Workspace", workspace} }); break; case WatcherChangeTypes.Changed: case WatcherChangeTypes.Created: var aclfileLocalPath = workspace.TrimWorekspacePath(item.Target.FullName, false); pstack.SetValue("Event", Mogami.Core.Constructions.UpdateVirtualStatusEventType.UPDATE); pstack.SetValue(ActivityParameterStack.WORKSPACE_FILEINFO, item.Target); pstack.SetValue(ActivityParameterStack.WORKSPACE_FILEPATH, aclfileLocalPath); // ē§»åå¾ć®ćć”ć¤ć«ćć¹ pstack.SetValue(ActivityParameterStack.WORKSPACE, workspace); var results_changed = workflow.Invoke(new Dictionary <string, object> { { "ParameterStack", pstack }, //{"EventType", UpdateVirtualStatusEventType.UPDATE}, //{"Target", item.Target}, //{"Workspace", workspace} }); break; case WatcherChangeTypes.Deleted: var aclfileLocalPath_Delete = workspace.TrimWorekspacePath(item.Target.FullName, false); pstack.SetValue("Event", Mogami.Core.Constructions.UpdateVirtualStatusEventType.DELETE); pstack.SetValue(ActivityParameterStack.WORKSPACE_FILEINFO, item.Target); pstack.SetValue(ActivityParameterStack.WORKSPACE_FILEPATH, aclfileLocalPath_Delete); // åé¤ćććć”ć¤ć« pstack.SetValue(ActivityParameterStack.WORKSPACE, workspace); pstack.SetValue("WF_DeleteAclMappingFilePath", fileNameWithputExtension); var results_deleted = workflow.Invoke(new Dictionary <string, object> { { "ParameterStack", pstack }, //{"EventType", UpdateVirtualStatusEventType.DELETE}, //{"Target", item.Target}, //{"DeleteAclHash", @pair.Key}, //{"Workspace", workspace} }); break; } } else { if (File.Exists(item.Target.FullName)) { switch (@lastItem.EventType) { case WatcherChangeTypes.Renamed: case WatcherChangeTypes.Changed: case WatcherChangeTypes.Created: var aclfileLocalPath_Update = workspace.TrimWorekspacePath(item.Target.FullName, false); pstack.SetValue("Event", Mogami.Core.Constructions.UpdateVirtualStatusEventType.UPDATE); pstack.SetValue(ActivityParameterStack.WORKSPACE_FILEINFO, item.Target); pstack.SetValue(ActivityParameterStack.WORKSPACE_FILEPATH, aclfileLocalPath_Update); // åé¤ćććć”ć¤ć« pstack.SetValue(ActivityParameterStack.WORKSPACE, workspace); var results_changed = workflow.Invoke(new Dictionary <string, object> { { "ParameterStack", pstack }, //{"EventType", UpdateVirtualStatusEventType.UPDATE}, //{"Target", item.Target}, //{"Workspace", workspace} }); break; case WatcherChangeTypes.Deleted: var aclfileLocalPath_Delete = workspace.TrimWorekspacePath(item.Target.FullName, false); pstack.SetValue("Event", Mogami.Core.Constructions.UpdateVirtualStatusEventType.DELETE); pstack.SetValue(ActivityParameterStack.WORKSPACE_FILEINFO, item.Target); pstack.SetValue(ActivityParameterStack.WORKSPACE_FILEPATH, aclfileLocalPath_Delete); // åé¤ćććć”ć¤ć« pstack.SetValue(ActivityParameterStack.WORKSPACE, workspace); var results_deleted = workflow.Invoke(new Dictionary <string, object> { { "ParameterStack", pstack }, //{"EventType", UpdateVirtualStatusEventType.DELETE}, //{"Target", item.Target}, //{"Workspace", workspace} }); break; } } else { LOG.InfoFormat("ć{0}ććÆååØććŖćē©ēćć”ć¤ć«ć®ćććå¦ēćć¹ććććć¾ćć", item.Target.FullName); } } dbc.SaveChanges(); } } catch (Exception expr) { LOG.ErrorFormat("ćæć¤ćć¼å¦ēęćØć©ć¼ = {0}", expr.Message); } // å¦ēćēµäŗćććć”ć¤ć«ććé¤å¤ćŖć¹ćććåé¤ćć¾ć string ignoreUpdateFile; _IgnoreUpdateFiles.TryDequeue(out ignoreUpdateFile); if (item.Target.Extension != ".aclgene") { _IgnoreUpdateFiles.TryDequeue(out ignoreUpdateFile); } } } // [CPUä½æēØēć«åƾććć«ć¼ćé 延ćč”ć] var cpuPer = _CpuCounter.NextValue(); if (cpuPer > 90.0) { await Task.Delay(100); // 100msecå¾ ę© } else if (cpuPer > 30.0) { //await Task.Delay(10); // 10msecå¾ ę© } } timer.Enabled = true; }
//Saravanan N - 20th May, 2014 - Return type altered as long. /// <summary> /// Persist Other Income. /// </summary> /// <param name="userId"></param> /// <param name="sessionData"></param> /// <param name="otherIncomeData"></param> /// <param name="historyData"></param> /// <param name="userDataId"></param> /// <param name="errorMessageList"></param> /// <returns></returns> public Tuple <long, bool> PersistOtherIncome(dynamic taxReturn) { long userId = 0; TaxReturnData taxReturnData = null; JTL.Tax1040.BusinessObject.Tax1040 taxObject = null; bool hasEligibilityDiagnostics = false; //Commented to diaplay Error Message for defect 14176 //bool fromIncomeGateway = false; OtherIncome otherIncome = null; bool isNew = false; try { if (taxReturn != null) { taxReturnData = JsonConvert.DeserializeObject <TaxReturnData>(taxReturn.TaxReturnData.ToString()); userId = Utilities.ConvertToLong(taxReturn.userId); //Retrieving TaxObject from database taxObject = Utilities.GetTaxObjectByUserIdAndUserDataId(userId, taxReturnData.UserDataId); //Converting Json to OtherIncome by DeSerializing otherIncome = JsonConvert.DeserializeObject <OtherIncome>(taxReturnData.TaxData); //Check whether this Persist call coming from OtherIncomeGateway page. //fromIncomeGateway = taxReturn.fromIncomeGateway; } if (taxObject != null && otherIncome != null) { if (taxObject.Income == null) { taxObject.Income = new Income(); isNew = true; } else { isNew = false; } taxObject.Income.OtherIncome = otherIncome; } //Commented to diaplay Error Message for defect 14176 //if (!fromIncomeGateway) //{ if (taxObject.ErrorMessages == null) { taxObject.ErrorMessages = new List <ErrorMessage>(); } // Clear the Error messages //SSB & RRB messageRepository.ClearErrorMessages(taxObject.ErrorMessages, Constants.TOPIC_OTHER_INCOME_SSB_RRB); //Alaska messageRepository.ClearErrorMessages(taxObject.ErrorMessages, Constants.TOPIC_OTHER_INCOME_Alaska); //State & Local messageRepository.ClearErrorMessages(taxObject.ErrorMessages, Constants.TOPIC_OTHER_INCOME_State_And_Local); //Other Income for Eligibility Section messageRepository.ClearErrorMessages(taxObject.ErrorMessages, Constants.TOPIC_OTHER_INCOME); //Workflow Validation Section dynamic input = new Microsoft.Activities.Extensions.WorkflowArguments(); input.Tax1040Object = taxObject; //var errorMessage = messageRepository.GetErrorMessages(); var errorMessage = HttpRuntime.Cache["ErrorMessageCollection"] as Dictionary <string, ErrorMessage>; var errorMessages = new ErrorMessages(errorMessage); input.ErrorMessages = errorMessages; // TODO 4-June-14 vivek Added eligibility work flow if (taxObject != null && taxObject.Income != null && taxObject.Income.OtherIncome != null && taxObject.Income.OtherIncome.SSB != null && taxObject.Income.OtherIncome.RRB != null) { //Saravanan N - 1st Aug, 2014 - While user removing Box 5 (SSB & RRB) for Spouse then also this workflow has to be called. Otherwise the modification in Spouse which will be reflected in workflow only while TaxPayer Net Benefits (SSB & RRB) value exists. //Vincent-16July2014-Check the SSB & RRB TaxpayerNet Benefits as NULL //Checking if the SSB & RRB as value and not equal to Zero. //if ((taxObject.Income.OtherIncome.SSB.TaxpayerNetBenefits != null || taxObject.Income.OtherIncome.RRB.TaxpayerNetBenefits != null)) //{ var output = Microsoft.Activities.Extensions.WorkflowArguments.FromDictionary(WorkflowInvoker.Invoke(new Form1040EZSSBEligibilityWithNoValidation(), input)); //} //Saravanan N - 1st Aug, 2014 - If ER2 already exists, now the user changed Box 5 value as 0 or empty then the IsLine2SSBTaxable property in SSBWorksheet will be set False. Based on this bool variable the error message will be removed from Taxobject. if (taxObject.F1040EZ != null && taxObject.F1040EZ.F1040EZWorkSheets != null && taxObject.F1040EZ.F1040EZWorkSheets.SSBWorkSheet != null && taxObject.F1040EZ.F1040EZWorkSheets.SSBWorkSheet.IsLine2SSBTaxable == false) { //Remoe already existing eligibility error in tax object. taxObject.ErrorMessages.RemoveAll(em => em.ErrorCode == Constants.OTHERINCOME_TAXABLE_SOCIAL_SECURITY_AND_RAILROAD_BENEFITS); } } BusinessFieldValidations(otherIncome, taxObject.ErrorMessages, errorMessages); //TODO vivek - 7-4-14 need to be change the work flow. var output1 = Microsoft.Activities.Extensions.WorkflowArguments.FromDictionary(WorkflowInvoker.Invoke (new OtherIncomeBusinessRuleValidation(), input)); //10Jul2014 Sathish added coded to check Taxable Income Eligibility taxObject.ErrorMessages.RemoveAll(em => em.ErrorCode == Constants.TAX_AND_WRAP_UP_TAXABLE_INCOME); var taxableIncome = Microsoft.Activities.Extensions.WorkflowArguments.FromDictionary(WorkflowInvoker.Invoke (new F1040EZTaxableIncomeEligibilityCheck(), input)); //Hard Stopper Check hasEligibilityDiagnostics = taxObject.ErrorMessages.Any(em => em.Topic == Constants.TOPIC_OTHER_INCOME && em.ErrorCode.StartsWith("OtherIncome_ER")); //} if (taxObject != null) { taxReturnData.UserDataId = Utilities.PersistTaxObject(userId, taxReturnData.UserDataId, taxObject); } //02-Sep-2014 Bhavani Audit functionality implementation var description = isNew ? "Persist OtherIncome, ClassName: {0}, Method Name: {1}" : "Update OtherIncome:, ClassName: {0}, Method Name: {1}"; Utilities.PersistAuditInfo(userId, taxReturnData.UserDataId, description, GetType().Name, Constants.Tab_INCOME, Constants.TOPIC_OTHER_INCOME); return(new Tuple <long, bool>(taxReturnData.UserDataId, hasEligibilityDiagnostics)); } catch (Exception ex) { throw ex; } }
static void Main() { WorkflowInvoker.Invoke(new Sequence1()); }
/*[DependsOnAttribute("Variables")] * public Activity<bool> Condition { get; set; }*/ protected override void Execute(NativeActivityContext context) { Variable <string> _CurrentTime = new Variable <string> { Name = "CurrentTime" }; Variable <string> _resTask = new Variable <string> { Name = "_resTask" }; Variable <int> _AmountTasks = new Variable <int> { Name = "_AmountTasks", Default = 0 }; Variable <int> _i = new Variable <int> { Name = "_i", Default = 0 }; Variable <bool> _condition = new Variable <bool> { Name = "condit", Default = true }; var c = System.TimeSpan.Parse(context.GetValue(_TimeExecution)); Activity executeTasksToWorkflow = new Sequence { Variables = { _CurrentTime, _AmountTasks, _i, _condition, _resTask }, Activities = { new GetAmountTasksToWorkflow { IdWorkflow = context.GetValue(_IdWorkflow), Result = _AmountTasks }, new WriteLine { Text = new InArgument <string>((e) => "Cantidad de tareas: " + _AmountTasks.Get(e)), }, new Assign <int> { To = _i, Value = 0 }, new While { Condition = _condition, Body = new Sequence { Activities = { new Delay { Duration = System.TimeSpan.Parse(context.GetValue(_TimeExecution)) }, new Assign <string> { To = _CurrentTime, Value = DateTime.Now.ToString() }, new Tracking { IdWorkflow = context.GetValue(_IdWorkflow), CurrentTime = _CurrentTime }, new WriteLine { Text = _CurrentTime }, new ExecuteTask { TaskNumber = new InArgument <int>((env) => _i.Get(env)), IdWorkflow = context.GetValue(_IdWorkflow), Result = _resTask }, new WriteLine { Text = new InArgument <string>((env) => "ejecutando en tarea " + (_i.Get(env) + 1)) }, new Assign <int> { To = _i, Value = new InArgument <int>((env) => _i.Get(env) + 1) }, new WriteLine { Text = _resTask }, new If { Condition = new InArgument <bool>((env) => _i.Get(env) >= _AmountTasks.Get(env)), Then = new Assign <bool> { To = _condition, Value = false } } } } }, new WriteLine { Text = "finalizado Worflow nro " + context.GetValue(_IdWorkflow) } } }; WorkflowInvoker.Invoke(executeTasksToWorkflow); }
public void EmptyArgs() { Assert.ThrowsException <ArgumentException>(() => WorkflowInvoker.Invoke(new CheckPoint())); }
static void Main(string[] args) { Activity workflow1 = new Workflow1(); WorkflowInvoker.Invoke(workflow1); }
internal static void RunConstraints(ActivityUtilities.ChildActivity childActivity, ActivityUtilities.ActivityCallStack parentChain, IList <Constraint> constraints, ProcessActivityTreeOptions options, bool suppressGetChildrenViolations, ref IList <ValidationError> validationErrors) { if (constraints != null) { Activity toValidate = childActivity.Activity; LocationReferenceEnvironment environment = toValidate.GetParentEnvironment(); Dictionary <string, object> inputDictionary = new Dictionary <string, object>(2); for (int constraintIndex = 0; constraintIndex < constraints.Count; constraintIndex++) { Constraint constraint = constraints[constraintIndex]; // there may be null entries here if (constraint == null) { continue; } inputDictionary[Constraint.ToValidateArgumentName] = toValidate; ValidationContext validationContext = new ValidationContext(childActivity, parentChain, options, environment); inputDictionary[Constraint.ToValidateContextArgumentName] = validationContext; IDictionary <string, object> results = null; try { results = WorkflowInvoker.Invoke(constraint, inputDictionary); } catch (Exception e) { if (Fx.IsFatal(e)) { throw; } ValidationError constraintExceptionValidationError = new ValidationError(SR.InternalConstraintException(constraint.DisplayName, toValidate.GetType().FullName, toValidate.DisplayName, e.ToString()), false) { Source = toValidate, Id = toValidate.Id }; ActivityUtilities.Add(ref validationErrors, constraintExceptionValidationError); } if (results != null) { if (results.TryGetValue(Constraint.ValidationErrorListArgumentName, out object resultValidationErrors)) { IList <ValidationError> validationErrorList = (IList <ValidationError>)resultValidationErrors; if (validationErrorList.Count > 0) { if (validationErrors == null) { validationErrors = new List <ValidationError>(); } string prefix = ActivityValidationServices.GenerateValidationErrorPrefix(childActivity.Activity, parentChain, options, out Activity source); for (int validationErrorIndex = 0; validationErrorIndex < validationErrorList.Count; validationErrorIndex++) { ValidationError validationError = validationErrorList[validationErrorIndex]; validationError.Source = source; validationError.Id = source.Id; if (!string.IsNullOrEmpty(prefix)) { validationError.Message = prefix + validationError.Message; } validationErrors.Add(validationError); } } } } if (!suppressGetChildrenViolations) { validationContext.AddGetChildrenErrors(ref validationErrors); } } } }
public void Execute(IJobExecutionContext context) { WorkflowInvoker.Invoke(new Main()); }
public void TestDynamicActivityGeneric() { var x = 100; var y = 200; var a = new DynamicActivity <int> { DisplayName = "Dynamic Plus", Properties = { new DynamicActivityProperty() { Name = "XX", Type = typeof(InArgument <int>), }, new DynamicActivityProperty() { Name = "YY", Type = typeof(InArgument <int>), }, }, Implementation = () => { var t1 = new Variable <int>("t1"); var plus = new Plus() { X = new ArgumentValue <int>() { ArgumentName = "XX" }, Y = new ArgumentValue <int>() { ArgumentName = "YY" }, Z = t1, //So Output Z will be assigned to t1 }; var s = new System.Activities.Statements.Sequence() { Variables = { t1 }, Activities = { plus, new System.Activities.Statements.Assign <int> { To = new ArgumentReference <int> { ArgumentName = "Result" }, //I just had a good guess about how Result get assigned. Value = new InArgument <int>(env => t1.Get(env)), }, }, }; return(s); }, }; var dic = new Dictionary <string, object>(); dic.Add("XX", x); dic.Add("YY", y); var r = WorkflowInvoker.Invoke(a, dic); Assert.Equal(300, r); }
public void EtwEvents() { List <EventWrittenEventArgs> recordedEvents = null; using (WfTracingEventListener verboseListener = new WfTracingEventListener()) { verboseListener.EnableEvents(WfEventSource.Instance, EventLevel.Verbose); var workflow1 = new Sequence() { DisplayName = "Hello World Sequence" }; workflow1.Activities.Add(new WriteLine() { Text = "Hello World!", DisplayName = "Display greeting" }); WorkflowInvoker.Invoke(workflow1); recordedEvents = verboseListener.RecordedEvents; } var sr = new StringReader(HelloWorldEtwEvents); sr.ReadLine(); string line = null; List <CompareEvent> expectedEvents = new List <CompareEvent>(); while ((line = sr.ReadLine()) != null) { expectedEvents.Add(new CompareEvent(line)); } foreach (var actualEvent in recordedEvents) { bool isMatch = false; int i; for (i = 0; i < expectedEvents.Count; i++) { var expectedEvent = expectedEvents[i]; if (expectedEvent.EventId != actualEvent.EventId) { continue; } if (expectedEvent.Level != actualEvent.Level) { continue; } bool keywordsMatch = true; foreach (var keywordField in typeof(WfEventSource.Keywords).GetTypeInfo().DeclaredFields) { long keyword = (long)keywordField.GetValue(null); if ((expectedEvent.Keywords & keyword) != ((long)actualEvent.Keywords & keyword)) { keywordsMatch = false; break; } } if (!keywordsMatch) { continue; } var payload = actualEvent.Payload.ToArray(); Guid temp; if (payload.Length >= 1 && (payload[0].GetType() == typeof(Guid) || (payload[0].GetType() == typeof(string) && Guid.TryParse(payload[0] as string, out temp)))) { payload[0] = string.Empty; } var actualMessage = string.Format(actualEvent.Message, payload); if (expectedEvent.Message != actualMessage) { continue; } isMatch = true; break; } Assert.True(isMatch, string.Format("ID: {0}, Level: {1}, Keywords: {2}, Message: {3}", actualEvent.EventId, actualEvent.Level, actualEvent.Keywords, string.Format(actualEvent.Message, actualEvent.Payload.ToArray()))); expectedEvents.RemoveAt(i); } Assert.Empty(expectedEvents); }
static void Main(string[] args) { // create orders Variable <Order> order1 = new Variable <Order>() { Name = "Order1", Default = new LambdaValue <Order>(c => new Order(650, CustomerType.Residential)) }; Variable <Order> resultOrder1 = new Variable <Order>() { Name = "ResultOrder1" }; Variable <Order> order2 = new Variable <Order>() { Name = "Order2", Default = new LambdaValue <Order>(c => new Order(15000, CustomerType.Business)) }; Variable <Order> resultOrder2 = new Variable <Order>() { Name = "ResultOrder2" }; Variable <Order> order3 = new Variable <Order>() { Name = "Order3", Default = new LambdaValue <Order>(c => new Order(650, CustomerType.Business)) }; Variable <Order> resultOrder3 = new Variable <Order>() { Name = "ResultOrder3" }; // create and run workflow instance WorkflowInvoker.Invoke( new Sequence { Variables = { order1, order2, order3, resultOrder1, resultOrder2, resultOrder3 }, Activities = { //--------------------------------------- // Rule: Order > 500 and CustomerType is Residential //--------------------------------------- new WriteLine { Text = new InArgument <string>("OrderValue > 500 and is Residential customer => discount = 5%") }, new WriteLine { Text = new InArgument <string>(c => string.Format(" Before Evaluation: {0}", order1.Get(c).ToString())) }, new ExternalizedPolicy4 <Order> { RulesFilePath = @"..\..\ApplyDiscount.rules", RuleSetName = "DiscountRuleSet", TargetObject = new InArgument <Order>(order1), ResultObject = new OutArgument <Order>(resultOrder1) }, new WriteLine { Text = new InArgument <string>(c => string.Format(" After Evaluation: {0}", resultOrder1.Get(c).ToString())) }, //--------------------------------------- // Rule: Order > 10000 and CustomerType is Businesss //--------------------------------------- new WriteLine(), new WriteLine { Text = new InArgument <string>("OrderValue > 10000 and is Business customer => discount = 10%") }, new WriteLine { Text = new InArgument <string>(c => string.Format(" Before Evaluation: {0}", order2.Get(c).ToString())) }, new ExternalizedPolicy4 <Order> { RulesFilePath = @"..\..\ApplyDiscount.rules", RuleSetName = "DiscountRuleSet", TargetObject = new InArgument <Order>(order2), ResultObject = new OutArgument <Order>(resultOrder2) }, new WriteLine { Text = new InArgument <string>(c => string.Format(" After Evaluation: {0}", resultOrder2.Get(c).ToString())) }, //--------------------------------------- // No Rules Applied //--------------------------------------- new WriteLine(), new WriteLine { Text = new InArgument <string>("This order does not match any of the rules above") }, new WriteLine { Text = new InArgument <string>(c => string.Format(" Before Evaluation: {0}", order3.Get(c).ToString())) }, new ExternalizedPolicy4 <Order> { RulesFilePath = @"..\..\ApplyDiscount.rules", RuleSetName = "DiscountRuleSet", TargetObject = new InArgument <Order>(order3), ResultObject = new OutArgument <Order>(resultOrder3) }, new WriteLine { Text = new InArgument <string>(c => string.Format(" After Evaluation: {0}", resultOrder3.Get(c).ToString())) } } } ); // wait until the user press a key Console.WriteLine("Press any key to exit..."); Console.Read(); }
/// <summary> /// /// </summary> /// <param name="userId"></param> /// <param name="taxReturnData"></param> /// <returns></returns> public Tuple <long, bool> PersistTaxesAndWrapUpData(long userId, TaxReturnData taxReturnData) { Tuple <long, bool> userData = null; try { JTL.Tax1040.BusinessObject.Tax1040 taxObject; //Retrieving TaxObject from database taxObject = Utilities.GetTaxObjectByUserIdAndUserDataId(userId, taxReturnData.UserDataId); //28May2014 Sathish Creat person if person detail not updated. Used in federal tax and wrap up work flow for line 10 calc. if (taxObject == null || taxObject.PersonalDetails == null || taxObject.PersonalDetails.PrimaryTaxPayer == null) { if (taxObject == null) { taxObject = new BusinessObject.Tax1040() { PersonalDetails = new PersonalDetails() { PrimaryTaxPayer = new PrimaryTaxPayer() { FilingStatus = FilingStatus.Single, Person = new Person() } } } } ; if (taxObject.PersonalDetails == null) { taxObject.PersonalDetails = new PersonalDetails() { PrimaryTaxPayer = new PrimaryTaxPayer() { FilingStatus = FilingStatus.Single, Person = new Person() } }; } if (taxObject.PersonalDetails.PrimaryTaxPayer == null) { taxObject.PersonalDetails.PrimaryTaxPayer = new PrimaryTaxPayer() { FilingStatus = FilingStatus.Single, Person = new Person() }; } Tuple <long, bool> userDataId = personalInfoRepository.PersistPrimaryTaxPayer(taxObject.PersonalDetails.PrimaryTaxPayer, userId, taxReturnData.UserDataId, Constants.TOPIC_PERSONAL_FILINGSTATUS); taxReturnData.UserDataId = userDataId.Item1; //Retrieving TaxObject from database //26Aug2014 Sathish Get Tax object after personal info persist to get the error message list taxObject = Utilities.GetTaxObjectByUserIdAndUserDataId(userId, taxReturnData.UserDataId); } //Converting Json to OtherIncome by DeSerializing TaxesAndPenalties taxesAndPenalties = JsonConvert.DeserializeObject <TaxesAndPenalties>(taxReturnData.TaxData); if (taxObject != null && taxesAndPenalties != null) { taxObject.TaxesAndPenalties = new TaxesAndPenalties(); taxObject.TaxesAndPenalties = taxesAndPenalties; } if (taxObject.ErrorMessages == null) { taxObject.ErrorMessages = new List <ErrorMessage>(); } // Clear the Error messages exist for this topic. messageRepository.ClearErrorMessages(taxObject.ErrorMessages, Constants.TOPIC_TAX_AND_WRAPUP); //Workflow Validation Section dynamic input = new Microsoft.Activities.Extensions.WorkflowArguments(); input.Tax1040Object = taxObject; //var errorMessage = messageRepository.GetErrorMessages(); var errorMessage = HttpRuntime.Cache["ErrorMessageCollection"] as Dictionary <string, ErrorMessage>; var errorMessages = new ErrorMessages(errorMessage); input.ErrorMessages = errorMessages; //BusinessFieldValidations(otherIncome, taxObject.ErrorMessages, errorMessages); if (taxObject.TaxesAndPenalties != null) { var output = Microsoft.Activities.Extensions.WorkflowArguments.FromDictionary(WorkflowInvoker.Invoke(new TaxAndWrapUpEligibilityCheck(), input)); hasEligibilityDiagnostics = taxObject.ErrorMessages.Any(em => em.Topic == Constants.TOPIC_TAX_AND_WRAPUP && em.ErrorCode.StartsWith(Constants.TOPIC_TAX_AND_WRAPUP + "_ER")); taxObject.ErrorMessages.RemoveAll(em => em.ErrorCode == Constants.TAX_AND_WRAP_UP_REQUIRED_REFUND_DETAIL); taxObject.ErrorMessages.RemoveAll(em => em.ErrorCode == Constants.TAX_AND_WRAP_UP_MISSING_INCOME); dynamic federalSummaryInput = new Microsoft.Activities.Extensions.WorkflowArguments(); federalSummaryInput.Tax1040Object = taxObject; federalSummaryInput.IsTaxableIncomeExceedCheck = true; federalSummaryInput.IsRefundAvailableCheck = true; federalSummaryInput.IsIncomeAndRefundAllZeros = true; federalSummaryInput.ErrorMessages = errorMessages; output = Microsoft.Activities.Extensions.WorkflowArguments.FromDictionary( WorkflowInvoker.Invoke(new FederalSummaryWithNoValidation(), federalSummaryInput)); } BusinessValidation(taxObject.TaxesAndPenalties, taxObject.ErrorMessages, errorMessages); taxReturnData.UserDataId = Utilities.PersistTaxObject(userId, taxReturnData.UserDataId, taxObject); userData = new Tuple <long, bool>(taxReturnData.UserDataId, hasEligibilityDiagnostics); //vincent, 2-sep-14, Persist Audit information string description = "Persist TaxesAndWrapUpData, ClassName: {0}, Method Name: {1}"; Utilities.PersistAuditInfo(userId, taxReturnData.UserDataId, description, this.GetType().Name, Constants.Tab_TAX_AND_WRAPUP, Constants.TOPIC_TAX_AND_WRAPUP); } catch (Exception ex) { ExceptionHandling.LogException(userId, "Class:TaxesAndWrapUpRepository,Method Name:PersistTaxesAndWrapUpData", ex); } return(userData); }
public void TestDynamicActivityGenericWithGeneric() { var x = 100; var y = 200; var a = new DynamicActivity <long> { DisplayName = "Dynamic Multiply", Properties = { new DynamicActivityProperty() { Name = "XX", Type = typeof(InArgument <long>), }, new DynamicActivityProperty() { Name = "YY", Type = typeof(InArgument <long>), }, }, Implementation = () => { var t1 = new Variable <long>("t1"); var multiply = new System.Activities.Expressions.Multiply <long, long, long>() { Left = new ArgumentValue <long>() { ArgumentName = "XX" }, Right = new ArgumentValue <long>() { ArgumentName = "YY" }, Result = t1, }; var s = new System.Activities.Statements.Sequence() { Variables = { t1 }, Activities = { multiply, new System.Activities.Statements.Assign <long> { To = new ArgumentReference <long> { ArgumentName = "Result" }, Value = new InArgument <long>(env => t1.Get(env)), }, }, }; return(s); }, }; var dic = new Dictionary <string, object>(); dic.Add("XX", x); dic.Add("YY", y); var r = WorkflowInvoker.Invoke(a, dic); Assert.Equal(20000L, r); }
static void Main(string[] args) { WorkflowInvoker.Invoke(new GuessNumberGameSequenceWF()); }
/// <summary> /// Delete and then Persist Form1099G. /// </summary> /// <param name="userId"></param> /// <param name="userDataId"></param> /// <param name="form1099GId"></param> /// <param name="errorMessageList"></param> public void DeleteAndPersistOtherIncome(long userId, long userDataId, OtherIncomeType otherIncomeType) { JTL.Tax1040.BusinessObject.Tax1040 taxObject; try { //Retrieving TaxObject from database taxObject = Utilities.GetTaxObjectByUserIdAndUserDataId(userId, userDataId); //Converting Json to Form1099G by DeSerializing if (taxObject != null && taxObject.Income != null && taxObject.Income.OtherIncome != null) { switch (otherIncomeType) { case OtherIncomeType.SocialSecurityAndRailRoadBenefits: taxObject.Income.OtherIncome.SSB = null; taxObject.Income.OtherIncome.RRB = null; taxObject.Income.OtherIncome.HasSsbAndRrb = false; // Clear the Error messages messageRepository.ClearErrorMessages(taxObject.ErrorMessages, Constants.TOPIC_OTHER_INCOME_SSB_RRB); //Vincent - 17 June, 2014 - Clear Eligibility HardStopper Errors. messageRepository.ClearErrorMessages(taxObject.ErrorMessages, Constants.TOPIC_OTHER_INCOME, 0, "OtherIncome_ER2"); //Yogalakshmi - 2nd July 2014 - To clear the datas in SSB & RRB Worksheet when the records are deleted. if (taxObject.F1040EZ != null && taxObject.F1040EZ.F1040EZWorkSheets != null && taxObject.F1040EZ.F1040EZWorkSheets.SSBWorkSheet != null) { taxObject.F1040EZ.F1040EZWorkSheets.SSBWorkSheet = null; Utilities.PersistTaxObject(userId, userDataId, taxObject); } break; case OtherIncomeType.AlaskaDividendIncome: taxObject.Income.OtherIncome.AlaskaPermanentFundDividend = null; taxObject.Income.OtherIncome.HasAlaskaPermanantFund = false; // Clear the Error messages messageRepository.ClearErrorMessages(taxObject.ErrorMessages, Constants.TOPIC_OTHER_INCOME_Alaska); break; //Added by prasana on 15.07.2014 after Income spec update 2.3 case OtherIncomeType.StateTaxRefund: taxObject.Income.OtherIncome.StateOrLocalIncomeTaxRefunds = null; taxObject.Income.OtherIncome.HasStateTaxRefund = false; taxObject.Income.OtherIncome.HasStateAndLocalTaxDeductionPriorYear = false; // Clear the Error messages messageRepository.ClearErrorMessages(taxObject.ErrorMessages, Constants.TOPIC_OTHER_INCOME_State_And_Local); break; } //10Jul2014 Sathish added coded to check Taxable Income Eligibility dynamic input = new Microsoft.Activities.Extensions.WorkflowArguments(); input.Tax1040Object = taxObject; //Obtain the List of Error Messages from DB. //var errorMessagesFromDB = messageRepository.GetErrorMessages(); var errorMessagesFromDB = HttpRuntime.Cache["ErrorMessageCollection"] as Dictionary <string, ErrorMessage>; var errorMessagesAll = new ErrorMessages(errorMessagesFromDB); //Assisn error message list into workflow input param. input.ErrorMessages = errorMessagesAll; //10Jul2014 Sathish added coded to check Taxable Income Eligibility taxObject.ErrorMessages.RemoveAll(em => em.ErrorCode == Constants.TAX_AND_WRAP_UP_TAXABLE_INCOME); var taxableIncome = Microsoft.Activities.Extensions.WorkflowArguments.FromDictionary(WorkflowInvoker.Invoke (new F1040EZTaxableIncomeEligibilityCheck(), input)); //02-Sep-2014 Bhavani Audit functionality implementation var topicName = string.Empty; switch (otherIncomeType) { case OtherIncomeType.AlaskaDividendIncome: topicName = Constants.TOPIC_OTHER_INCOME_Alaska; break; case OtherIncomeType.StateTaxRefund: topicName = Constants.TOPIC_OTHER_INCOME_State_And_Local; break; case OtherIncomeType.SocialSecurityAndRailRoadBenefits: topicName = Constants.TOPIC_OTHER_INCOME_SSB_RRB; break; } var description = "Delete OtherIncome: " + otherIncomeType + ", ClassName: {0}, Method Name: {1}"; Utilities.PersistAuditInfo(userId, userDataId, description, GetType().Name, Constants.Tab_INCOME, topicName); } //Persist latest TaxObject. taxReturnDataService.PersistTaxReturnData(userId, string.Empty, Utilities.ConvertTaxObjectToJSON(taxObject), string.Empty, userDataId); } catch (Exception ex) { throw ex; } }
public void CreateDynNotes() { var workflowUserId = Guid.NewGuid(); var workflowCorrelationId = Guid.NewGuid(); var workflowInitiatingUserId = Guid.NewGuid(); var serviceProvider = new StubIServiceProvider(); var pluginContext = new StubIPluginExecutionContext(); this.Service = new StubIOrganizationService(); this.IWorKFlowContext = new StubIWorkflowContext(); this.Factory = new StubIOrganizationServiceFactory(); this.TracingService = new StubITracingService(); this.IWorKFlowContext.UserIdGet = () => { return(workflowUserId); }; this.Factory.CreateOrganizationServiceNullableOfGuid = id => { return(Service); }; PostCreateSRCreateDynNotes updateDeviceRequestEmployeeDetails = new PostCreateSRCreateDynNotes(); var invoker = new WorkflowInvoker(updateDeviceRequestEmployeeDetails); invoker.Extensions.Add <ITracingService>(() => this.TracingService); invoker.Extensions.Add <IWorkflowContext>(() => this.IWorKFlowContext); invoker.Extensions.Add <IOrganizationServiceFactory>(() => this.Factory); pluginContext.PrimaryEntityNameGet = () => "incident"; pluginContext.PrimaryEntityIdGet = () => new Guid("884A078B-0467-E711-80F5-3863BB3C0660"); ParameterCollection paramCollection = new ParameterCollection(); ParameterCollection paramCollectionPostImage = new ParameterCollection(); Entity incident = new Entity("incident"); incident.Id = new Guid("884A078B-0467-E711-80F5-3863BB3C0660"); paramCollection.Add("Target", incident); pluginContext.InputParametersGet = () => paramCollection; EntityImageCollection postImage = new EntityImageCollection { (new KeyValuePair <string, Entity>("PostImage", incident)) }; Helper.Helper.PluginVariables(serviceProvider, pluginContext, this.Service, 40, "Create", postImage); this.Service.RetrieveMultipleQueryBase = (query) => { EntityCollection collection = new EntityCollection(); string entityName = string.Empty; if (query.GetType().Name.Equals("QueryExpression")) { entityName = ((QueryExpression)query).EntityName; } else { entityName = ((QueryByAttribute)query).EntityName; } if (entityName == "smp_problemtypedescription") { Entity configuration = new Entity("smp_configuration"); configuration.Id = new Guid("884A078B-0466-E712-80F5-3863BB3C0560"); configuration["smp_problemtypedescriptionid"] = new Guid("884A078B-0466-E712-80F5-3863BB3C0560"); configuration["smp_problemtypedescriptionname"] = "Sample Name"; collection.Entities.Add(configuration); } return(collection); }; this.Service.RetrieveStringGuidColumnSet = delegate(string entity, Guid guid, ColumnSet secondaryUserColumnSet) { if (entity == "incident") { Entity incidents = new Entity(entity); incidents["caseorigincode"] = new OptionSetValue(1); incidents["smp_createdfrom"] = new OptionSetValue(1); incidents["smp_problembuilding"] = new EntityReference(string.Empty, Guid.NewGuid()); incidents["smp_problemclassid"] = new EntityReference(string.Empty, Guid.NewGuid()); incidents["smp_problemtypeid"] = new EntityReference(string.Empty, Guid.NewGuid()); incidents.Attributes["statecode"] = new OptionSetValue(1); incidents.Id = new Guid("884A078B-0467-E711-80F5-3863BB3C0660"); return(incidents); } return(null); }; IDictionary <string, object> inputs = new Dictionary <string, object>(); EntityReference newIncident = new EntityReference(incident.LogicalName, incident.Id); inputs["ServiceRequest"] = newIncident; var output = invoker.Invoke(inputs); }
//Saravanan N - 20th May, 2014 - Code refactored from its Controller. /// <summary> /// Get OtherIncome Summary /// </summary> /// <param name="userInputData"></param> /// <returns></returns> public System.Tuple <OtherIncome, IEnumerable <ErrorMessage>, string, string, string, string> GetOtherIncomeSummary(dynamic userInputData) { try { OtherIncome otherIncome = null; IEnumerable <ErrorMessage> lstErrorMessages = null; //Get TaxObject from Database. BusinessObject.Tax1040 taxObject = Utilities.GetTaxObjectByUserIdAndUserDataId(Utilities.ConvertToLong(userInputData.userId.Value), Utilities.ConvertToLong(userInputData.userDataId.Value)); if (taxObject != null) { //Tax Payer and Spouse name taxPayerAndSpouseNames = Utilities.GetTaxPayerAndSpouseName(taxObject); if (taxObject.Income != null && taxObject.Income.OtherIncome != null) { otherIncome = taxObject.Income.OtherIncome; } if (taxObject.ErrorMessages != null) { //If ErrorMessages doesn't have any object it returns count as 1 for NULL object. So removing this NULL object from the list. taxObject.ErrorMessages.RemoveAll(err => err == null); if (taxObject.ErrorMessages.Count > 0) { //Get Other Income related error messages. // 17Jun2014 Sathish reterived all the error message including eligibility rule for navigation to hot stop from summary lstErrorMessages = taxObject.ErrorMessages.Where(err => err.Topic == Constants.TOPIC_OTHER_INCOME_SSB_RRB || err.Topic == Constants.TOPIC_OTHER_INCOME_Alaska || err.Topic == Constants.TOPIC_OTHER_INCOME_State_And_Local || err.Topic == Constants.TOPIC_OTHER_INCOME).OrderBy(x => x.ErrorType); } } // Clearing the eligibility Error messages. //SSB & RRB messageRepository.ClearErrorMessages(taxObject.ErrorMessages, topic: Constants.TOPIC_OTHER_INCOME, errorCode: "OtherIncome_ER2"); //Workflow Validation Section dynamic input = new Microsoft.Activities.Extensions.WorkflowArguments(); input.Tax1040Object = taxObject; //var errorMessage = messageRepository.GetErrorMessages(); var errorMessage = HttpRuntime.Cache["ErrorMessageCollection"] as Dictionary <string, ErrorMessage>; var errorMessages = new ErrorMessages(errorMessage); input.ErrorMessages = errorMessages; //Vincent-30Jun2014-Rechecking the Eligibility Check For ER2 if (taxObject != null && taxObject.Income != null && taxObject.Income.OtherIncome != null && taxObject.Income.OtherIncome.SSB != null && taxObject.Income.OtherIncome.RRB != null) { //Saravanan N - 1st Aug, 2014 - While user removing Box 5 (SSB & RRB) for Spouse then also this workflow has to be called. Otherwise the modification in Spouse which will be reflected in workflow only while TaxPayer Net Benefits (SSB & RRB) value exists. //Vincent-16July2014-Check the SSB & RRB TaxpayerNet Benefits as NULL //Checking if the SSB & RRB as value and not equal to Zero. //if ((taxObject.Income.OtherIncome.SSB.TaxpayerNetBenefits != null || taxObject.Income.OtherIncome.RRB.TaxpayerNetBenefits != null)) //{ var output = Microsoft.Activities.Extensions.WorkflowArguments.FromDictionary(WorkflowInvoker.Invoke(new Form1040EZSSBEligibilityWithNoValidation(), input)); //} } //Saravanan N - 1st Aug, 2014 - If ER2 already exists, now the user changed Box 5 value as 0 or empty then the IsLine2SSBTaxable property in SSBWorksheet will be set False. Based on this bool variable the error message will be removed from Taxobject. if (taxObject.F1040EZ != null && taxObject.F1040EZ.F1040EZWorkSheets != null && taxObject.F1040EZ.F1040EZWorkSheets.SSBWorkSheet != null && taxObject.F1040EZ.F1040EZWorkSheets.SSBWorkSheet.IsLine2SSBTaxable == false) { //Remoe already existing eligibility error in tax object. taxObject.ErrorMessages.RemoveAll(em => em.ErrorCode == Constants.OTHERINCOME_TAXABLE_SOCIAL_SECURITY_AND_RAILROAD_BENEFITS); } if (taxObject != null && taxObject.UserDataId != 0) { Utilities.PersistTaxObject(userInputData.userId.Value, userInputData.userDataId.Value, taxObject); } } //02-Sep-2014 Bhavani Audit functionality implementation var description = "Get OtherIncome Summary, ClassName: {0}, Method Name: {1}"; Utilities.PersistAuditInfo(userInputData.userId.Value, userInputData.userDataId.Value, description, GetType().Name, Constants.Tab_INCOME, Constants.TOPIC_OTHER_INCOME); return(new Tuple <OtherIncome, IEnumerable <ErrorMessage>, string, string, string, string>(otherIncome, lstErrorMessages, taxPayerAndSpouseNames.Item1, taxPayerAndSpouseNames.Item2, taxPayerAndSpouseNames.Item3, taxPayerAndSpouseNames.Item4)); } catch (Exception ex) { throw ex; } }
protected override void Execute(CodeActivityContext context) { Variable <string> _CurrentTime = new Variable <string> { Name = "CurrentTime" }; Variable <string> _AmountTasks = new Variable <string> { Name = "_AmountTasks" }; Variable <string> _i = new Variable <string> { Name = "_i" }; var c = System.TimeSpan.Parse(context.GetValue(_TimeExecution)); Activity GetTrack = new Sequence { Variables = { _CurrentTime, _AmountTasks }, Activities = { new GetAmountTasksToWorkflow { Result = _AmountTasks }, new WriteLine { Text = _AmountTasks }, new Assign <string> { To = _i, Value = "0" }, new While { Condition = int.Parse(_i.Get(context)) < int.Parse(_AmountTasks.Get(context)), Body = new Sequence { Activities = { new Assign <string> { To = _CurrentTime, Value = "momento del Fin: " + DateTime.Now.ToString() + " duraciĆ³n: " + context.GetValue(_TimeExecution) }, new WriteLine { Text = "ejecutando en _i " + _i.Get(context).ToString() }, new Delay { Duration = System.TimeSpan.Parse(context.GetValue(_TimeExecution)) }, new Tracking { CurrentTime = _CurrentTime }, new WriteLine { Text = _CurrentTime }, new Assign <string> { To = _i, Value = (int.Parse(_i.ToString()) + 1).ToString() } } } } } }; WorkflowInvoker.Invoke(GetTrack); }
static void Main() { Activity workflow = new Workflow1(); WorkflowInvoker.Invoke(workflow); }
static void Main(string[] args) { Activity workflowToRun = new SimpleWorkflow(); WorkflowInvoker.Invoke(workflowToRun); }
protected override void Execute(CodeActivityContext context) { var wf = ActivityXamlServices.Load(@"C:\Private projects\Core Framework\Stardust\Stardust.Core.CrossCuttingTest\WorkFlows\Workflow.xaml"); WorkflowInvoker.Invoke(wf); }
public void TestDynamicActivity() { var x = 100; var y = 200; var a = new DynamicActivity { DisplayName = "Dynamic Plus", Properties = { new DynamicActivityProperty() { Name = "XX", Type = typeof(InArgument <int>), Value = new InArgument <int>(x), //You can't do Value=x, otherwise, System.InvalidCastException : Unable to cast object of type 'System.Int32' to type 'System.Activities.Argument' }, new DynamicActivityProperty() { Name = "YY", Type = typeof(InArgument <int>), //Value=y, }, new DynamicActivityProperty() { Name = "ZZ", Type = typeof(OutArgument <int>), } }, Implementation = () => { Variable <int> t1 = new Variable <int>("t1"); var plus = new Plus() { X = new ArgumentValue <int>() { ArgumentName = "XX" }, Y = new ArgumentValue <int>() { ArgumentName = "YY" }, Z = t1, }; var s = new System.Activities.Statements.Sequence() { Variables = { t1 }, Activities = { plus, new System.Activities.Statements.Assign <int> { To = new ArgumentReference <int> { ArgumentName = "ZZ" }, //So the Value will be assigned to property ZZ. Noted that ArgumentReference<> is a CodeActivity<> Value = new InArgument <int>(env => t1.Get(env)), //So the Value will be wired from t1 in context. }, }, }; return(s); }, }; var dic = new Dictionary <string, object>(); // dic.Add("XX", x); dic.Add("YY", y); var r = WorkflowInvoker.Invoke(a, dic); Assert.Equal(300, (int)r["ZZ"]); }
static void Main(string[] args) { WorkflowInvoker.Invoke(GetClientWorkflow()); Console.WriteLine("Press [ENTER] to exit"); Console.ReadLine(); }
static void Main(string[] args) { WorkflowInvoker.Invoke(new Workflow1()); }