public void ConvertGapTest(bool _damage, Model.GapType _gapType, string _reason) { Model.Gap gap = new Model.Gap(); if (_damage == true) { mei.Damage meidamage = new Damage(); if (_reason != null) { meidamage.SetAgent(_reason); } TinyConverters.ConvertGap(gap, meidamage); } else { mei.Gap meigap = new mei.Gap(); if (_reason != null) { meigap.SetReason(_reason); } TinyConverters.ConvertGap(gap, meigap); } Assert.AreEqual(_gapType, gap.GapType); Assert.AreEqual(_reason, gap.Reason); }
public void ConvertGapTest() { Sequence gapSequence = SequenceHandler.CreateNewSequence("Test", "Gap", "noPage", "Tenor", 3); Panel gapPanel = MeiImport.ImportDocument("..\\..\\files\\tests\\DamageTest.xml").Root.Descendants <Panel>().FirstOrDefault(); SequenceHandler.FlattenMeiToSequence(gapPanel, gapSequence); Controller.BuildSequence(gapSequence); Assert.IsInstanceOfType(gapSequence.ObjectsInSequence[4], typeof(Model.Gap)); Model.Gap gap1 = (Model.Gap)gapSequence.ObjectsInSequence[4]; Assert.AreEqual(gap1.GapType, GapType.Damage); Assert.IsInstanceOfType(gapSequence.ObjectsInSequence[6], typeof(Model.Gap)); Model.Gap gap2 = (Model.Gap)gapSequence.ObjectsInSequence[6]; Assert.AreEqual(gap2.GapType, GapType.Damage); Assert.IsInstanceOfType(gapSequence.ObjectsInSequence[7], typeof(Model.Gap)); Model.Gap gap3 = (Model.Gap)gapSequence.ObjectsInSequence[7]; Assert.AreEqual(gap3.GapType, GapType.Damage); Assert.IsInstanceOfType(gapSequence.ObjectsInSequence[20], typeof(Model.Gap)); Model.Gap gap4 = (Model.Gap)gapSequence.ObjectsInSequence[20]; Assert.AreEqual(gap4.GapType, GapType.Gap); }
public void BuildSequence_checkConversion() { foreach (Sequence testSequence in testList) { foreach (ObjectInSequence obj in testSequence.ObjectsInSequence) { Assert.AreNotEqual(obj.Evidence, Evidence.Invalid); switch (obj.Type) { case ObjectType.Accidental: Accidental accid = (Accidental)obj; Assert.AreNotEqual(Model.AccidType.Null, accid.AccidentalType); break; case ObjectType.Barline: Barline bl = (Barline)obj; Assert.AreNotEqual(Model.BarlineType.Null, bl.BarlineType); break; case ObjectType.Clef: Model.Clef clef = (Model.Clef)obj; Assert.AreNotEqual(Model.Clefshape.Null, clef.Shape); break; case ObjectType.KeyAccidental: KeyAccidental keyacc = (KeyAccidental)obj; Assert.AreNotEqual(Model.AccidType.Null, keyacc.AccidentalType); break; case ObjectType.Mensur: Model.Mensur mens = (Model.Mensur)obj; Assert.AreNotEqual(0, mens.Tempus); break; case ObjectType.Note: Model.Note note = (Model.Note)obj; Assert.AreNotEqual(0, note.WrittenPitch); Assert.AreNotEqual(Model.Duration.Null, note.Duration); break; case ObjectType.Proportion: Proportion prop = (Proportion)obj; Assert.AreNotEqual(0, prop.Num); Assert.AreNotEqual(0, prop.Numbase); break; case ObjectType.Rest: Model.Rest rest = (Model.Rest)obj; Assert.AreNotEqual(Model.Duration.Null, rest.Duration); break; case ObjectType.Custos: break; case ObjectType.Dot: break; case ObjectType.Gap: Model.Gap gap = (Model.Gap)obj; Assert.AreNotEqual(Model.GapType.Null, gap.GapType); break; default: Assert.Fail($"Test of {obj.Type} {obj.ID} failed!"); break; } } } }