public void Setup() { mockedInputSource = new Mock<CTLInputSource>(); mockedDomain = new Mock<CTLDomain>(); ctlModel = new CTLModel(mockedInputSource.Object, mockedDomain.Object); // Setup event-related data startedEvent = new InputElement("1", "TEST", InputElement.Type.Event, InputElement.Action.Started); generatedEvent = new CTLEvent("1", "TEST", 0, 0); mockedDomain.Setup(domain => domain.generateEvent(startedEvent)).Returns(generatedEvent); stoppedEvent = new InputElement("1", "TEST", InputElement.Type.Event, InputElement.Action.Stopped); // Setup task-related data startedTask = new InputElement("2", "TEST", InputElement.Type.Task, InputElement.Action.Started); startedTask.secondaryIndentifier = "1"; generatedTask = new CTLTask("2", "TEST"); mockedDomain.Setup(domain => domain.generateTask(startedTask)).Returns(generatedTask); stoppedTask = new InputElement("2", "TEST", InputElement.Type.Task, InputElement.Action.Stopped); // Setup validTasks with which to calculate multitask elements validTask1 = new CTLTask("2", "ARI_IN"); validTask2 = new CTLTask("3", "COMMUNICATIE"); usedDomains = new List<int>(new int[] { (int)InformationDomain.InformationDomainUnknown }); }
/// <summary> /// Generates a CTLEvent instance from a InputElement instance /// </summary> /// <param name="inputElement">The InputElement to generate from</param> /// <returns>The generated CTLEvent</returns> public override CTLEvent generateEvent(InputElement inputElement) { CTLEvent ctlEvent = null; // The possible event types with their corresponding mo and lip values Tuple<string, double, int>[] validValues = {Tuple.Create("GESTRANDE_TREIN", 0.6, 2), Tuple.Create("GESTOORDE_WISSEL", 0.8, 3), Tuple.Create("VERTRAAGDE_TREIN_OK", 0.2, 1), Tuple.Create("VERTRAAGDE_TREIN_PROBLEEM", 0.3, 1)}; if (inputElement != null && inputElement.identifier != null && inputElement.name != null) { foreach(var values in validValues) { if (values.Item1.Equals(inputElement.name)) { ctlEvent = new CTLEvent(inputElement.identifier, inputElement.name, values.Item2, values.Item3); } } } return ctlEvent; }