public void ParseMethodName()
        {
            (string, int, string[]) Parse(string managedMethodName)
            {
                ManagedNameParser.ParseManagedMethodName(managedMethodName, out var method, out var arity, out var parameterTypes);
                return(method, arity, parameterTypes);
            }

            void AssertParse(string expectedMethod, int expectedArity, string[] expectedParams, string expression)
            {
                var(method, arity, parameters) = Parse(expression);
                Assert.AreEqual(expectedMethod, method);
                Assert.AreEqual(expectedArity, arity);
                CollectionAssert.AreEqual(expectedParams, parameters, "parameter comparison");
            }

            Assert.AreEqual(("Method", 0, null), Parse("Method"));
            Assert.AreEqual(("Method", 0, null), Parse("Method()"));
            Assert.AreEqual(("Method<A,B>", 2, null), Parse("Method<A,B>`2()"));
            AssertParse("Method", 0, new string[] { "System.Int32" }, "Method(System.Int32)");
            AssertParse("Method", 0, new string[] { "TypeA", "List<B>" }, "Method(TypeA,List<B>)");
            AssertParse("Method", 1, new string[] { "B", "List<B>" }, "Method`1(B,List<B>)");
            AssertParse("Method", 0, new string[] { "B[]" }, "Method(B[])");
            AssertParse("Method", 0, new string[] { "A[,]", "B[,,][]" }, "Method(A[,],B[,,][])");
        }
        public void ParseInvalidMethodName()
        {
            (string, int, string[]) Parse(string methodName)
            {
                ManagedNameParser.ParseManagedMethodName(methodName, out var method, out var arity, out var parameterTypes);
                return(method, arity, parameterTypes);
            }

            Assert.ThrowsException <InvalidManagedNameException>(() => Parse(" Method"), "Whitespace is not valid in a ManagedName (pos: 0)");
            Assert.ThrowsException <InvalidManagedNameException>(() => Parse("Method( List)"), "Whitespace is not valid in a ManagedName (pos: 7)");

            Assert.ThrowsException <InvalidManagedNameException>(() => Parse("Method(List)xa"), "Unexpected characters after the end of the ManagedName (pos: 7)");

            Assert.ThrowsException <InvalidManagedNameException>(() => Parse("Method("), "ManagedName is incomplete");
            Assert.ThrowsException <InvalidManagedNameException>(() => Parse("Method`4a"), "Method arity must be numeric");
        }