public void StateMachineExecutor_SURF_Five_Results_Execute() { // Arrange StateMachineExecutor.Parameters parms = new StateMachineExecutor.Parameters() { Results = new List <IResult>() { new SURFResult() { Coordinator = new Point(1, 23), Note = ENote.C, NumberOfElements = 100, Pixel = Color.Red }, new SURFResult() { Coordinator = new Point(1, 40), Note = ENote.Dm, NumberOfElements = 87, Pixel = Color.Yellow }, new SURFResult() { Coordinator = new Point(40, 23), Note = ENote.G, NumberOfElements = 87, Pixel = Color.Yellow }, new SURFResult() { Coordinator = new Point(15, 44), Note = ENote.Dm, NumberOfElements = 87, Pixel = Color.Yellow }, new SURFResult() { Coordinator = new Point(15, 44), Note = ENote.Dm, NumberOfElements = 87, Pixel = Color.Yellow } }, MaxNotes = 30, TargetType = EModelType.SURF }; // Act List <IState> states = new StateMachineExecutor(parms).Execute(); // Assert Assert.IsNotNull(states); Assert.AreEqual(30, states.Count); states.ForEach(s => { Assert.IsFalse(s.LinkedStates.IsNullOrEmpty()); Assert.AreEqual(4, s.LinkedStates.Count); }); }
private void InitUpdates() { this.updatesStateMachine = new UpdatesStateMachine(); this.updatesStateMachine.UIContext = AppWorkspace; this.stateMachineExecutor = new StateMachineExecutor(this.updatesStateMachine); this.stateMachineExecutor.SyncContext = AppWorkspace; this.stateMachineExecutor.StateMachineFinished += OnStateMachineFinished; this.stateMachineExecutor.StateBegin += OnStateBegin; this.stateMachineExecutor.StateWaitingForInput += OnStateWaitingForInput; }
private void DisposeUpdates() { if (this.stateMachineExecutor != null) { this.stateMachineExecutor.StateMachineFinished -= OnStateMachineFinished; this.stateMachineExecutor.StateBegin -= OnStateBegin; this.stateMachineExecutor.StateWaitingForInput -= OnStateWaitingForInput; this.stateMachineExecutor.Dispose(); this.stateMachineExecutor = null; } this.updatesStateMachine = null; }
private List <IState> ExecuteStateMachine(MusicalizationArgs parser, Model model) { StateMachineExecutor.Parameters parameters = new StateMachineExecutor.Parameters() { LogPath = parser.LogPath, MaxNotes = parser.MaxNotes, ProbabilityCalculation = parser.ProbabilityCalculation, Results = model.Result, SequenceLog = parser.SequenceLog, StateLog = parser.StateLog, TargetType = parser.TargetType }; StateMachineExecutor stateMachineExecutor = new StateMachineExecutor(parameters); stateMachineExecutor.NotificationRequested += LogNotifier; return(stateMachineExecutor.Execute()); }
private void CloseButton_Click(object sender, EventArgs e) { if (this.updatesStateMachine != null) { this.updatesStateMachine.Abort(); this.updatesStateMachine = null; this.closeButton.Enabled = false; } Close(); }
public void StateMachineExecutor_Execute_ThrowArgumentException() { StateMachineExecutor executor = new StateMachineExecutor(null); }