public void SimpleExecution()
        {
            var runtime = new WorkflowRuntime();
            var handle  = runtime.RunProgram(SampleProgram.Create());

            // Simulate input reception
            string input        = "400";
            string bookmarkName = "ReadLine";

            handle.Resume(bookmarkName, input);

            // Finished without problems
        }
Exemple #2
0
    void clickOnRunButton(object obj, EventArgs args)
    {
        int timeout = -1;

        if (!Int32.TryParse(txtTimeout.Text, out timeout))
        {
            timeout = -1;
        }
        ProgBox pb = new ProgBox(Orientation.Horizontal, 5);

        this.progStatus.Add(pb);
        pb.Show();
        SampleProgram sp = new SampleProgram(this.path, timeout, pb.changeValues);

        this.samplePrograms.AddLast(sp);
    }
        public void SuspendedExecution()
        {
            var runtime = new WorkflowRuntime();

            var handle = runtime.RunProgram(SampleProgram.Create());

            Guid programId = handle.ProgramId;

            // Save the workflow
            handle.Passivate();

            // Force GC
            handle = null;
            GC.Collect();

            // Simulate input reception
            string input        = "400";
            string bookmarkName = "ReadLine";

            // Get back the handle we "lost"
            handle = runtime.GetProgramHandle(programId);
            handle.Resume(bookmarkName, input);
        }
Exemple #4
0
 static void Main(string[] args)
 {
     using var qsim = new QuantumSimulator();
     SampleProgram.Run(qsim).Wait();
     Console.WriteLine("SampleProgram executed successfully!");
 }
        public void sumTest()
        {
            SampleProgram sp = new SampleProgram();

            Assert.AreEqual(4, sp.sum(2, 2));
        }