public void CustomDocumentToLuceneDocumentForClass() { //test AddDocumentFields var customSandoDocument = new ClassDocument(MyCustomClassForTesting.GetClassElement()); var luceneDocumentWithCustomFields = customSandoDocument.GetDocument(); Assert.IsTrue(luceneDocumentWithCustomFields != null); Assert.IsTrue(luceneDocumentWithCustomFields.GetField("Bam") != null); Assert.IsTrue(luceneDocumentWithCustomFields.GetField("Bam").StringValue().Equals("Zaow")); }
public void LuceneDocToCustomProgramElementForClass() { //test Create var document = MyCustomClassForTesting.GetLuceneDocument(); var customProgramElement = ConverterFromHitToProgramElement.Create(document).Convert(); var myCustomProgramElementForTesting = customProgramElement as MyCustomClassForTesting; Assert.IsTrue(myCustomProgramElementForTesting != null); Assert.IsTrue(myCustomProgramElementForTesting.Bam.Equals("Zaow")); }
public static ClassElement GetSampleClassElement( AccessLevel accessLevel = AccessLevel.Public, int definitionLineNumber = 11, string extendedClasses = "SimpleClassBase", string fullFilePath = "C:/Projects/SampleClass.cs", string implementedInterfaces = "IDisposable", string name = "SimpleClassName", string namespaceName = "Sando.Indexer.UnitTests", string snippet = "public class SimpleClass\n{private int field1;\nprotected void method(){}\n}", string modifiers = "" ) { var classElement = new MyCustomClassForTesting(name, definitionLineNumber, -1000, fullFilePath, snippet, accessLevel, namespaceName, extendedClasses, implementedInterfaces, modifiers, "junk body"); classElement.Bam = "Zaow"; return(classElement); }
public static ClassElement GetSampleClassElement( AccessLevel accessLevel = AccessLevel.Public, int definitionLineNumber = 11, string extendedClasses = "SimpleClassBase", string fullFilePath = "C:/Projects/SampleClass.cs", string implementedInterfaces = "IDisposable", string name = "SimpleClassName", string namespaceName = "Sando.Indexer.UnitTests", string snippet = "public class SimpleClass\n{private int field1;\nprotected void method(){}\n}", string modifiers = "" ) { var classElement = new MyCustomClassForTesting(name, definitionLineNumber, -1000, fullFilePath, snippet, accessLevel, namespaceName, extendedClasses, implementedInterfaces, modifiers, "junk body"); classElement.Bam = "Zaow"; return classElement; }