Пример #1
0
        public void Method_Formatter_Supports_Generic_Classes()
        {
            var methodInfo = typeof(GenericClass <>).GetMethod("GetGeneric");
            var format     = MethodSignatureFormatter.Create(methodInfo, new[] { "test" });

            Assert.AreEqual("Snap.Tests.GenericClass`1<T>::GetGeneric({test})", format);
        }
Пример #2
0
        public void Method_Formatter_Supports_Generic_Methods()
        {
            var testClass  = new MethodFormatTestClass();
            var methodInfo = testClass.GetType().GetMethod("GetGeneric");
            var format     = MethodSignatureFormatter.Create(methodInfo, new[] { "test" });

            Assert.AreEqual("Snap.Tests.MethodFormatTestClass::GetGeneric<T>({test})", format);
        }
Пример #3
0
        public void Method_Formatter_Supports_Multiple_Generic_Parameters()
        {
            var testClass  = new MethodFormatTestClass();
            var methodInfo = testClass.GetType().GetMethod("GetGenericMultiple");

            var signature = MethodSignatureFormatter.Create(methodInfo, new[] { "1", "3" });

            Assert.AreEqual("Snap.Tests.MethodFormatTestClass::GetGenericMultiple<T, TK>({1}, {3})", signature);
        }
Пример #4
0
        public void Method_Formatter_Supports_Multiple_Parameters()
        {
            var testClass  = new MethodFormatTestClass();
            var methodInfo = testClass.GetType().GetMethod("GetDateTime", new[] { typeof(int), typeof(int) });

            var signature = MethodSignatureFormatter.Create(methodInfo, new[] { "1", "3" });

            Assert.AreEqual("Snap.Tests.MethodFormatTestClass::GetDateTime({1}, {3})", signature);
        }
Пример #5
0
        public void Method_Formatter_Supports_Zero_Parameters()
        {
            var testClass  = new MethodFormatTestClass();
            var methodInfo = testClass.GetType().GetMethod("GetDateTime", new Type[] { });

            var signature = MethodSignatureFormatter.Create(methodInfo, new object[] {});

            Assert.AreEqual("Snap.Tests.MethodFormatTestClass::GetDateTime()", signature);
        }
Пример #6
0
        public void Method_Formatter_Translates_Calls_To_Strings()
        {
            var testClass  = new MethodFormatTestClass();
            var methodInfo = testClass.GetType().GetMethod("GetDateTime", new[] { typeof(int) });

            var signature = MethodSignatureFormatter.Create(methodInfo, new[] { "1" });

            Assert.AreEqual("Snap.Tests.MethodFormatTestClass::GetDateTime({1})", signature);
        }