public void ClonePatternAction_TypeIsCorrect() { foreach (var type in GetAllActionTypes()) { PatternAction patternAction = null; if (type == typeof(AddChordAction)) { patternAction = new AddChordAction(new ChordDescriptor(Enumerable.Empty <DryWetMidi.MusicTheory.Note>(), SevenBitNumber.MinValue, MusicalTimeSpan.Eighth)); } else if (type == typeof(AddNoteAction)) { patternAction = new AddNoteAction(new NoteDescriptor(Notes.A1, SevenBitNumber.MinValue, MusicalTimeSpan.Eighth)); } else if (type == typeof(AddPatternAction)) { patternAction = new AddPatternAction(new PatternBuilder().Build()); } else if (type == typeof(AddTextEventAction <>)) { patternAction = new AddTextEventAction <TextEvent>(string.Empty); } else if (type == typeof(MoveToAnchorAction)) { patternAction = new MoveToAnchorAction(AnchorPosition.First); } else if (type == typeof(SetGeneralMidi2ProgramAction)) { patternAction = new SetGeneralMidi2ProgramAction(GeneralMidi2Program.AcousticBassStringSlap); } else if (type == typeof(SetGeneralMidiProgramAction)) { patternAction = new SetGeneralMidiProgramAction(GeneralMidiProgram.AcousticBass); } else if (type == typeof(SetProgramNumberAction)) { patternAction = new SetProgramNumberAction(SevenBitNumber.MinValue); } else if (type == typeof(StepBackAction)) { patternAction = new StepBackAction(MusicalTimeSpan.Quarter); } else if (type == typeof(StepForwardAction)) { patternAction = new StepForwardAction(MusicalTimeSpan.Quarter); } else { patternAction = (PatternAction)Activator.CreateInstance(type); } var patternActionClone = patternAction.Clone(); Assert.AreEqual(patternAction.GetType(), patternActionClone.GetType(), $"Clone of {type} is of invalid type."); } }