protected static void ValidateFragmentSelection(ValidateFragmentSelectionParams selectionParams) { var geData = LoadProfile(selectionParams.NewProfileText); geData.Profile.Fragment = geData.Profile.Profile; geData.Profile.GetNodeProfileText(); Assert.AreEqual(selectionParams.IsSelectable, geData.Profile.IsSelectable(selectionParams.Start, selectionParams.End, false), "Is the specified profile text selectable? (" + selectionParams.Comment + ")"); var fragments = geData.Profile.GetSelection(selectionParams.Start, selectionParams.End); Assert.AreEqual(selectionParams.ExpectedText, fragments.ProfileText); Assert.AreEqual(selectionParams.FragmentTypes.Count, fragments.Fragments.Count); for (var i = 0; i < fragments.Fragments.Count; i++) { Assert.AreEqual(selectionParams.FragmentTypes[i], fragments.Fragments[i].FragmentType, "Fragment[" + i + "] (" + selectionParams.Comment + ")"); } Assert.AreEqual(selectionParams.ExpectedPrefix, fragments.Prefix, "Prefix (" + selectionParams.Comment + ")"); if (!fragments.HasPrefix) { Assert.IsNull(fragments.TextPrefix.Text, "Null Prefix (" + selectionParams.Comment + ")"); Assert.AreEqual("", selectionParams.ExpectedPrefix, "Blank Prefix (" + selectionParams.Comment + ")"); } Assert.AreEqual(selectionParams.ExpectedSuffix, fragments.Suffix, "Suffix (" + selectionParams.Comment + ")"); if (!fragments.HasSuffix) { Assert.IsNull(fragments.TextSuffix.Text, "Null Suffix (" + selectionParams.Comment + ")"); Assert.AreEqual("", selectionParams.ExpectedSuffix, "Blank Suffix (" + selectionParams.Comment + ")"); } Assert.AreEqual(selectionParams.ExpectedInfix, fragments.Infix, "Infix (" + selectionParams.Comment + ")"); if (!fragments.HasInfix) { Assert.IsNull(fragments.TextInfix.Text, "Null Infix (" + selectionParams.Comment + ")"); Assert.AreEqual("", selectionParams.ExpectedInfix, "Blank Infix (" + selectionParams.Comment + ")"); } }
public void FragmentSelectionTest(ValidateFragmentSelectionParams selectionParams) { ValidateFragmentSelection(selectionParams); }