コード例 #1
0
ファイル: Form1.cs プロジェクト: TylerHaigh/SDK
        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);
            }
        }
コード例 #2
0
        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);
        }
コード例 #3
0
        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());
        }
コード例 #4
0
ファイル: Program.cs プロジェクト: IcodeNet/cleansolution
 /// <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();
 }
コード例 #5
0
        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);
        }
コード例 #6
0
        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));
        }
コード例 #7
0
        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 = "YOUREMAIL",
                    UserPassword = "YOURPASSWORD"
                };
                
                // 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;
        }
コード例 #9
0
        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);
        }
コード例 #10
0
        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);
        }
コード例 #11
0
        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 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;
 }
コード例 #13
0
        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)"));
        }
コード例 #14
0
        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;
        }
コード例 #15
0
        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"]);
        }
コード例 #16
0
        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));
        }
コード例 #17
0
        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
        }
コード例 #18
0
 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");
 }
コード例 #19
0
 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"];
 }
コード例 #20
0
 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"];
 }
コード例 #21
0
        public void Create()
        {
            //CreateInterviewWorkflow2 ciw = new CreateInterviewWorkflow2();
            //ciw.Run();

            CreateInterviewWorkflow ciw = new CreateInterviewWorkflow();
            WorkflowInvoker wfi = new WorkflowInvoker(ciw);
            wfi.Invoke();
        }
コード例 #22
0
        public void NotifyCompletedWithNoDelegateShouldDoNothing()
        {
            var model = CountModelFactory.CreateModel();
            var invoker = new WorkflowInvoker(new NotifyCountCompleted());
            invoker.Extensions.Add(model);

            invoker.Invoke();
            // No exception is success
        }
コード例 #23
0
        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();
        }
コード例 #24
0
        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);
        }
コード例 #25
0
        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);
            }
        }
コード例 #26
0
        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) );
            }
        }
コード例 #27
0
        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", [email protected]"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
        }
コード例 #28
0
        //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;
        }
コード例 #29
0
ファイル: Program.cs プロジェクト: TylerHaigh/SDK
        // 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();
        }
コード例 #30
0
ファイル: UnitTest1.cs プロジェクト: riezebosch/wfdev
        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"]);
        }