public static MyCustomProgramElementForTesting GetProgramElement()
 {
     var element =  new MyCustomProgramElementForTesting("customThingName", 123, -1000, @"C:\stuff\place.txt", "The text of the custom thing.");
     element.A = "A's value";
     element.B = "B's value";
     element.C = "C's value";
     return element;
 }
        public void CustomDocumentToLuceneDocument()
        {
            //test AddDocumentFields
            var customSandoDocument            = new SandoDocument(MyCustomProgramElementForTesting.GetProgramElement());
            var luceneDocumentWithCustomFields = customSandoDocument.GetDocument();

            Assert.IsTrue(luceneDocumentWithCustomFields != null);
        }
        public static MyCustomProgramElementForTesting GetProgramElement()
        {
            var element = new MyCustomProgramElementForTesting("customThingName", 123, -1000, @"C:\stuff\place.txt", "The text of the custom thing.");

            element.A = "A's value";
            element.B = "B's value";
            element.C = "C's value";
            return(element);
        }
        public void LuceneDocToCustomProgramElement()
        {
            //test ReadProgramElementFromDocument
            var customSandoDocument              = MyCustomProgramElementForTesting.GetLuceneDocument();
            var customProgramElement             = ConverterFromHitToProgramElement.Create(customSandoDocument).Convert();
            var myCustomProgramElementForTesting = customProgramElement as MyCustomProgramElementForTesting;

            Assert.IsTrue(myCustomProgramElementForTesting != null);
            Assert.IsTrue(myCustomProgramElementForTesting.A.Equals("A's value"));
            Assert.IsTrue(myCustomProgramElementForTesting.B.Equals("B's value"));
            Assert.IsTrue(myCustomProgramElementForTesting.C.Equals("C's value"));
        }
        public void RoundTrip()
        {
            var element = DocumentFactory.Create(MyCustomProgramElementForTesting.GetProgramElement());
            var generatedDocumentFromElement = element.GetDocument();
            var prefabLuceneDocument         = MyCustomProgramElementForTesting.GetLuceneDocument();

            foreach (var property in MyCustomProgramElementForTesting.GetProgramElement().GetCustomProperties())
            {
                if (!property.Name.Equals(ProgramElement.CustomTypeTag))
                {
                    Field field1 = generatedDocumentFromElement.GetField(property.Name);
                    Field field2 = prefabLuceneDocument.GetField(property.Name);
                    Assert.IsTrue(field1.StringValue().Equals(field2.StringValue()));
                }
            }
        }
        public void GetCustomDocumentFromFactoryTest()
        {
            var element = DocumentFactory.Create(MyCustomProgramElementForTesting.GetProgramElement());

            Assert.IsTrue(element != null);
        }