Beispiel #1
0
        /// <summary>
        /// Provides access to the ParseVerseSegmentsLine method
        /// </summary>
        public static void ParseVerseSegmentsLine(this ScrVers scrVers, string segmentsLine, string fileName = "testfile")
        {
            Versification internalVers = (Versification)ReflectionHelper.GetProperty(scrVers, "VersInfo");

            ReflectionHelper.CallMethodWithThrow(Versification.Table.Implementation, "ProcessVersLine",
                                                 "#! " + segmentsLine, fileName, ScrVersType.Unknown, "", internalVers);
        }
Beispiel #2
0
        /// <summary>
        /// Provides access to the ProcessVersLine method
        /// </summary>
        public static void ProcessVersLine(this ScrVers scrVers, string versLine)
        {
            Versification internalVers = (Versification)ReflectionHelper.GetProperty(scrVers, "VersInfo");

            ReflectionHelper.CallMethodWithThrow(Versification.Table.Implementation, "ProcessVersLine",
                                                 versLine, "testfile", ScrVersType.Unknown, "", internalVers);
        }
Beispiel #3
0
        /// <summary>
        /// Provides access to the ParseMappingLine method
        /// </summary>
        public static void ParseMappingLine(this ScrVers scrVers, string mappingLine)
        {
            Versification internalVers = scrVers.VersInfo;

            ReflectionHelper.CallMethodWithThrow(Versification.Table.Implementation, "ProcessVersLine",
                                                 mappingLine, "testfile", ScrVersType.Unknown, "", internalVers);
        }
        public void CallMethodWithThrow_InstanceMethodExistsOnDerivedType_ExpectToBeCalled()
        {
            MyDerivedClass   myClass = new MyDerivedClass();
            ReturnValueClass retVal  = (ReturnValueClass)ReflectionHelper.CallMethodWithThrow(myClass, "MyDerivedObjectMethod", 3, 9);

            Assert.IsNotNull(retVal);
            Assert.AreEqual(3, retVal.X);
            Assert.AreEqual(9, retVal.Y);
        }
Beispiel #5
0
        /// <summary>
        /// Clears all information from the internal versification for testing on a clean slate
        /// </summary>
        public static void ClearAllInfo(this ScrVers scrVers)
        {
            Versification internalVers = (Versification)ReflectionHelper.GetProperty(scrVers, "VersInfo");

            ((List <int[]>)ReflectionHelper.GetField(internalVers, "bookList")).Clear();
            scrVers.ClearExcludedVerses();
            ((Dictionary <int, string[]>)ReflectionHelper.GetField(internalVers, "verseSegments")).Clear();

            object mappings = ReflectionHelper.GetField(internalVers, "mappings");

            ReflectionHelper.CallMethodWithThrow(mappings, "Clear");
        }
Beispiel #6
0
 /// <summary>
 /// Provides access to the WriteToStream method
 /// </summary>
 public static void WriteToStream(this ScrVers scrVers, StringWriter stream)
 {
     ReflectionHelper.CallMethodWithThrow(scrVers.VersInfo, "WriteToStream", stream);
 }
Beispiel #7
0
 public void AfterItemsDeleted_EmptyList()
 {
     _lp.AfterItemsDeleted += delegate { throw new Exception("Should never get here!"); };
     ReflectionHelper.CallMethodWithThrow(_lp, "btnDelete_Click", new object[] { null, null });
 }
        public void CallMethodWithThrow_InstanceMethodMissing_ExpectException()
        {
            MyDerivedClass myClass = new MyDerivedClass();

            Assert.Throws <MissingMethodException>(() => ReflectionHelper.CallMethodWithThrow(myClass, "UnknownMethod", "blah"));
        }
        public void CallMethodWithThrow_InstanceMethodExistsOnBaseType_ExpectToBeCalled()
        {
            MyDerivedClass myClass = new MyDerivedClass();

            Assert.AreEqual("You got it!", ReflectionHelper.CallMethodWithThrow(myClass, "MyBaseStringMethod", "You "));
        }
 public void CallMethodWithThrow_StaticMethodMissing_ExpectException()
 {
     Assert.Throws <MissingMethodException>(() => ReflectionHelper.CallMethodWithThrow(typeof(MyStaticClass), "UnknownMethod", "blah"));
 }
 public void CallMethodWithThrow_StaticMethodExists_ExpectToBeCalled()
 {
     Assert.AreEqual(49, ReflectionHelper.CallMethodWithThrow(typeof(MyStaticClass), "MyIntMethod", 7));
 }