/// <summary> /// Initializes the shared dictionary. /// </summary> /// <param name="comparer">Comparre for keys</param> /// <param name="Runtime">BugFindingRuntime</param> public MockSharedDictionary(IEqualityComparer <TKey> comparer, BugFindingRuntime Runtime) { this.Runtime = Runtime; if (comparer != null) { DictionaryMachine = Runtime.CreateMachine(typeof(SharedDictionaryMachine <TKey, TValue>), SharedDictionaryEvent.InitEvent(comparer)); } else { DictionaryMachine = Runtime.CreateMachine(typeof(SharedDictionaryMachine <TKey, TValue>)); } }
/// <summary> /// Initializes the shared counter. /// </summary> /// <param name="value">Initial value</param> /// <param name="Runtime">BugFindingRuntime</param> public MockSharedCounter(int value, BugFindingRuntime Runtime) { this.Runtime = Runtime; CounterMachine = Runtime.CreateMachine(typeof(SharedCounterMachine)); var currentMachine = Runtime.GetCurrentMachine(); Runtime.SendEvent(CounterMachine, SharedCounterEvent.SetEvent(currentMachine.Id, value)); currentMachine.Receive(typeof(SharedCounterResponseEvent)).Wait(); }
/// <summary> /// Initializes the shared counter. /// </summary> /// <param name="value">Initial value</param> /// <param name="Runtime">BugFindingRuntime</param> public MockSharedCounter(int value, BugFindingRuntime Runtime) { this.Runtime = Runtime; CounterMachine = Runtime.CreateMachine(typeof(SharedCounterMachine)); Runtime.SendEvent(CounterMachine, SharedCounterEvent.SetEvent(value)); }
/// <summary> /// Initializes the shared register. /// </summary> /// <param name="value">Initial value</param> /// <param name="Runtime">Runtime</param> public MockSharedRegister(T value, BugFindingRuntime Runtime) { this.Runtime = Runtime; registerMachine = Runtime.CreateMachine(typeof(SharedRegisterMachine <T>)); Runtime.SendEvent(registerMachine, SharedRegisterEvent.SetEvent(value)); }