Example #1
0
        public void TestEventInheritanceRun()
        {
            var tcs     = new TaskCompletionSource <bool>();
            var runtime = new StateMachineRuntime();
            var a       = runtime.CreateMachine(typeof(A), null, new A.Configure(tcs), null);

            runtime.SendEvent(a, new A.E3());
            runtime.SendEvent(a, new E1());
            runtime.SendEvent(a, new E2());
            Assert.True(tcs.Task.Wait(2000), "Test timed out");
        }
Example #2
0
        public void RunWithLogger()
        {
            var configuration = PSharp.Configuration.Create().WithVerbosityEnabled(0);
            var runtime       = new StateMachineRuntime(configuration);
            ConcurrentQueue <MachineId> machines = new ConcurrentQueue <MachineId>();

            Parallel.For(0, Clients, index =>
            {
                machines.Enqueue(runtime.CreateMachine(typeof(SimpleMachine), new SetContextMessage(runtime)));
            });

            foreach (var machine in machines)
            {
                runtime.SendEvent(machine, new Halt());
            }
        }