public void SetCommandAction(byte oldActionIndex, byte newActionIndex, bool expectedActionChanged) { var useCommandActionChangedEvent = false; var syncCommand = new SyncCommand(); syncCommand.SetCommandAction(_actions[oldActionIndex]); syncCommand.CommandActionChangedEvent += () => { useCommandActionChangedEvent = true; }; syncCommand.SetCommandAction(_actions[newActionIndex]); Assert.Equal(_actions[newActionIndex], syncCommand.CommandAction); Assert.Equal(expectedActionChanged, useCommandActionChangedEvent); }
public async Task Process() { var syncCommand = new SyncCommand(); syncCommand.SetCommandAction(_actions[1]); syncCommand.FinishedSyncEvent += () => { _processOutputLines.Add("Finished"); }; await syncCommand.Process(); Assert.Equal("Process action1|Finished", string.Join('|', _processOutputLines.ToArray())); }