private static GenProfileFragment ValidateExpansion(GenDataBase d, string txt, FragmentType[] expectedFragmentTypes, string expectedExpansion, string message, string expectedProfileText = null) { var expected = expectedProfileText ?? txt; var profile = new GenCompactProfileParser(d.GenDataDef, "", txt); Assert.AreEqual(expectedFragmentTypes.Count(), profile.Body.Count, "Number of fragments expected"); for (var i = 0; i < profile.Body.Count; i++) { Assert.AreEqual(expectedFragmentTypes[i], profile.Body.Fragment[i].FragmentType); } Assert.AreEqual(expected, profile.ProfileText( ProfileFragmentSyntaxDictionary.ActiveProfileFragmentSyntaxDictionary)); Assert.AreEqual(expectedExpansion, GenFragmentExpander.Expand(d.GenDataDef, d.Root, profile.Fragment), message); return(profile); }
public void FileStreamProfileTest() { const string txt = "`[Class>:`Class.Name`,`]"; const string fileName = "GenProfileTest.prf"; var d = SetUpData(); if (File.Exists(fileName)) { File.Delete(fileName); } File.WriteAllText(fileName, txt); var profile = new GenCompactProfileParser(d.GenDataDef, fileName, ""); Assert.AreEqual(1, profile.Body.Count, "Only one fragment expected"); Assert.AreEqual(FragmentType.Segment, profile.Body.Fragment[0].FragmentType); Assert.AreEqual(txt, profile.ProfileText( ProfileFragmentSyntaxDictionary.ActiveProfileFragmentSyntaxDictionary)); Assert.AreEqual("Class,SubClass,Property,", GenFragmentExpander.Expand(d.GenDataDef, d.Root, profile.Fragment), "Class list expected"); }