forked from microsoft/coyote
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathProgram.cs
40 lines (34 loc) · 1.34 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
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
using System;
using Microsoft.Coyote.Actors;
using Microsoft.Coyote.Samples.Common;
namespace Microsoft.Coyote.Samples.DrinksServingRobot
{
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 = Actors.RuntimeFactory.Create(configuration);
runtime.OnFailure += OnRuntimeFailure;
Execute(runtime);
Console.ReadLine();
}
[Microsoft.Coyote.SystematicTesting.Test]
public static void Execute(IActorRuntime runtime)
{
LogWriter.Initialize(runtime.Logger);
runtime.RegisterMonitor<LivenessMonitor>();
runtime.CreateActor(typeof(FailoverDriver), new FailoverDriver.ConfigEvent(RunForever));
}
private static void OnRuntimeFailure(Exception ex)
{
LogWriter.Instance.WriteError("### Error: {0}", ex.Message);
}
}
}