forked from microsoft/coyote
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathProgram.cs
43 lines (37 loc) · 1.54 KB
/
Program.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
using System;
using Microsoft.Coyote.Actors;
using Microsoft.Coyote.Samples.Common;
namespace Microsoft.Coyote.Samples.CoffeeMachineActors
{
public static class Program
{
private static bool RunForever = false;
public static void Main()
{
// Optional: increases verbosity level to see the Coyote runtime log and sets it to output to the console.
// var configuration = Configuration.Create();
var configuration = Configuration.Create().WithVerbosityEnabled().WithConsoleLoggingEnabled();
RunForever = true;
IActorRuntime runtime = RuntimeFactory.Create(configuration);
runtime.OnFailure += OnRuntimeFailure;
Execute(runtime);
Console.ReadLine();
Console.WriteLine("User cancelled the test by pressing ENTER");
}
private static void OnRuntimeFailure(Exception ex)
{
Console.WriteLine("Unhandled exception: {0}", ex.Message);
}
[Microsoft.Coyote.SystematicTesting.Test]
public static void Execute(IActorRuntime runtime)
{
LogWriter.Initialize(runtime.Logger);
runtime.RegisterMonitor<LivenessMonitor>();
runtime.RegisterMonitor<DoorSafetyMonitor>();
ActorId driver = runtime.CreateActor(typeof(FailoverDriver), new ConfigEvent(RunForever));
runtime.SendEvent(driver, new FailoverDriver.StartTestEvent());
}
}
}