Beispiel #1
0
        public void ReplaceType()
        {
            var map = TypeMap.FromXDocument(XDocument.Parse(simpleSourceFile));

            var actualValue = map.GetTypeName("C#", "System.DateTime");

            Assert.AreEqual("System.DateTimeOffset", actualValue);
        }
Beispiel #2
0
        public void ReplaceInFormatter_Generic_Property()
        {
            var typedef = GetTypeDef <UWPProjection>();

            var map = TypeMap.FromXDocument(XDocument.Parse(genericInterfaceSourceFile));
            CSharpFullMemberFormatter formatter = new CSharpFullMemberFormatter(map);

            string actual = formatter.GetDeclaration(typedef.Resolve().Properties.Single(t => t.Name == "Thing"));

            Assert.AreEqual("public System.Collections.Generic.IList<int> Thing { get; }", actual);
        }
Beispiel #3
0
        public void ReplaceInFormatter_ButDont()
        {
            var typedef = GetTypeDef <UWPProjection>();

            var map = TypeMap.FromXDocument(XDocument.Parse(simplerSourceFile));
            CSharpFullMemberFormatter formatter = new CSharpFullMemberFormatter(map);

            string actualName = formatter.GetName(typedef, useTypeProjection: false);

            Assert.AreEqual("mdoc.Test.TypeMapTests.UWPProjection", actualName);
        }
Beispiel #4
0
        public void ReplaceInFormatter_Generic_Method_VB()
        {
            var typedef = GetTypeDef <UWPProjection>();

            var map = TypeMap.FromXDocument(XDocument.Parse(genericInterfaceSourceFile));
            VBMemberFormatter formatter = new VBMemberFormatter(map);

            string actual = formatter.GetDeclaration(typedef.Resolve().Methods.Single(t => t.Name == "Ok"));

            Assert.AreEqual("Public Function Ok (p As IList(Of IList(Of IList(Of Integer)))) As IList(Of IList(Of Integer))", actual);
        }
Beispiel #5
0
        public void ReplaceInFormatter_WrongLanguage()
        {
            var typedef = GetTypeDef <UWPProjection>();

            var map = TypeMap.FromXDocument(XDocument.Parse(simplerSourceFile));
            CppCxFullMemberFormatter formatter = new CppCxFullMemberFormatter(map);

            string actual     = formatter.GetDeclaration(typedef);
            string actualName = formatter.GetName(typedef);

            Assert.AreEqual("mdoc::Test::TypeMapTests::UWPProjection", actualName);
        }
Beispiel #6
0
        public void ReplaceInFormatter()
        {
            var typedef = GetTypeDef <UWPProjection>();

            var map = TypeMap.FromXDocument(XDocument.Parse(simplerSourceFile));
            CSharpFullMemberFormatter formatter = new CSharpFullMemberFormatter(map);

            string actual     = formatter.GetDeclaration(typedef);
            string actualName = formatter.GetName(typedef);

            Assert.AreEqual("public class System.String : mdoc.Test.IInt<int>", actual);
            Assert.AreEqual("System.String", actualName);
        }
Beispiel #7
0
        public void LoadTypeMap()
        {
            var map = TypeMap.FromXDocument(XDocument.Parse(simpleSourceFile));

            Assert.AreEqual(2, map.Items.Count);

            var item1 = map.Items.First();

            Assert.AreEqual("Windows.Foundation.IClosable", item1.From);
            Assert.AreEqual("System.IDisposable", item1.To);
            Assert.AreEqual("C#;VB.NET;F#", item1.Langs);
            Assert.AreEqual(3, item1.LangList.Count());

            var item2 = map.Items.Last();

            Assert.AreEqual("System.DateTime", item2.From);
            Assert.AreEqual("System.DateTimeOffset", item2.To);
            Assert.AreEqual("C#;F#", item2.Langs);
            Assert.AreEqual(2, item2.LangList.Count());
        }