using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Xunit; using SDKDocGenerator; namespace SDKDocGenerator.UnitTests { public class NDocMethodSignatureTests { [Fact] public void GenericReturnMethod() { var methodInfo = typeof(TestMethods).GetMethod("Query", new Type[] { typeof(string) }); var signature = NDocUtilities.DetermineNDocNameLookupSignature(methodInfo, ""); Assert.Equal("M:SDKDocGenerator.UnitTests.TestMethods.Query``1(System.String)", signature); } [Fact] public void CollectionTestMethod() { var methodInfo = typeof(TestMethods).GetMethods().First(x => x.Name == "CollectionTest"); var signature = NDocUtilities.DetermineNDocNameLookupSignature(methodInfo, ""); Assert.Equal( "M:SDKDocGenerator.UnitTests.TestMethods.CollectionTest(System.Collections.Generic.IList{System.Collections.Generic.IDictionary{System.String,SDKDocGenerator.UnitTests.TestMethods}})", signature); } [Fact] public void MultiOutTestMethod() { var methodInfo = typeof(TestMethods).GetMethods().First(x => x.Name == "MultiOutTest"); var signature = NDocUtilities.DetermineNDocNameLookupSignature(methodInfo, ""); Assert.Equal( "M:SDKDocGenerator.UnitTests.TestMethods.MultiOutTest(System.Int32@,System.String@)", signature); } [Fact] public void CollectionOutTestMethod() { var methodInfo = typeof(TestMethods).GetMethods().First(x => x.Name == "CollectionOutTest"); var signature = NDocUtilities.DetermineNDocNameLookupSignature(methodInfo, ""); Assert.Equal( "M:SDKDocGenerator.UnitTests.TestMethods.CollectionOutTest(System.Collections.Generic.IList{System.String}@)", signature); } } public class TestMethods { /// /// Test Method /// /// /// /// public T Query(string name) { return default(T); } /// /// Test Method /// /// public void CollectionTest(IList> param) { } /// /// Test Method /// /// /// public void MultiOutTest(out int s1, out string s2) { s1 = 1; s2 = "Test"; } /// /// Test Method /// /// public void CollectionOutTest(out IList param) { param = new List(); } } }