コード例 #1
0
        public void GenericClassDefinitionFullName()
        {
            var extractor = new TypeNameExtractor();

            extractor.GetName(typeof(IList <>), true).Should().Be("System.Collections.Generic.IList<T>");

            CollectionAssert.AreEquivalent(new[] {
                typeof(IList <>).Namespace
            }, extractor.Namespaces.ToArray());
        }
コード例 #2
0
        public void GenericClassDefinitionTwoName()
        {
            var extractor = new TypeNameExtractor();

            extractor.GetName(typeof(IDictionary <,>)).Should().Be("IDictionary<TKey, TValue>");

            CollectionAssert.AreEquivalent(new[] {
                typeof(IDictionary <,>).Namespace,
            }, extractor.Namespaces.ToArray());
        }
コード例 #3
0
        public void CanReturnLowercaseFullNameForVoidType()
        {
            var extractor = new TypeNameExtractor();

            extractor.GetName(typeof(void), true).Should().Be("void");

            CollectionAssert.AreEquivalent(new[] {
                typeof(void).Namespace,
            }, extractor.Namespaces.ToArray());
        }
コード例 #4
0
        public void NormalClassDefinitionFullName()
        {
            var extractor = new TypeNameExtractor();

            extractor.GetName(typeof(TypeNameExtractorFixture), true).Should().Be(typeof(TypeNameExtractorFixture).FullName);

            CollectionAssert.AreEquivalent(new[] {
                typeof(TypeNameExtractorFixture).Namespace
            }, extractor.Namespaces.ToArray());
        }
コード例 #5
0
        public void GenericClassName()
        {
            var extractor = new TypeNameExtractor();

            extractor.GetName(typeof(IList <int>)).Should().Be("IList<Int32>");

            CollectionAssert.AreEquivalent(new[] {
                typeof(IList <>).Namespace,
                typeof(Int32).Namespace
            }, extractor.Namespaces.ToArray());
        }
コード例 #6
0
        public void GenericClassInsideNonGenericInsideGenericClassFullName()
        {
            var extractor = new TypeNameExtractor();

            extractor.GetName(typeof(Test <,> .NonGeneric.Generic <,>), true).Should().Be(
                "Simple.Tests.Reflection.TypeNameExtractorFixture.Test<A, B>.NonGeneric.Generic<C, D>");

            CollectionAssert.AreEquivalent(new[] {
                typeof(TypeNameExtractorFixture).Namespace,
            }, extractor.Namespaces.ToArray());
        }
コード例 #7
0
        public void GenericClassInsideNonGenericInsideGenericClassName()
        {
            var extractor = new TypeNameExtractor();

            Assert.AreEqual("TypeNameExtractorFixture.Test<A, B>.NonGeneric.Generic<C, D>",
                            extractor.GetName(typeof(Test <,> .NonGeneric.Generic <,>)));

            CollectionAssert.AreEquivalent(new[] {
                typeof(TypeNameExtractorFixture).Namespace,
            }, extractor.Namespaces.ToArray());
        }
コード例 #8
0
        public void GenericClassTwoName()
        {
            var extractor = new TypeNameExtractor();

            extractor.GetName(typeof(IDictionary <string, int>)).Should().Be("IDictionary<String, Int32>");

            CollectionAssert.AreEquivalent(new[] {
                typeof(IDictionary <,>).Namespace,
                typeof(string).Namespace
            }, extractor.Namespaces.ToArray());
        }
コード例 #9
0
        public void GenericClassFullName()
        {
            var extractor = new TypeNameExtractor();

            Assert.AreEqual("System.Collections.Generic.IList<System.Int32>",
                            extractor.GetName(typeof(IList <int>), true));

            CollectionAssert.AreEquivalent(new[] {
                typeof(IList <>).Namespace,
                typeof(Int32).Namespace
            }, extractor.Namespaces.ToArray());
        }
コード例 #10
0
        public void GenericClassAsGenericParameter()
        {
            var extractor = new TypeNameExtractor();

            Assert.AreEqual("IDictionary<IList<Int32>, IList<String>>",
                            extractor.GetName(typeof(IDictionary <IList <int>, IList <string> >)));

            CollectionAssert.AreEquivalent(new[] {
                typeof(IDictionary <,>).Namespace,
                typeof(string).Namespace
            }, extractor.Namespaces.ToArray());
        }
コード例 #11
0
        public void GenericClassInnerFullName()
        {
            var extractor = new TypeNameExtractor();

            Assert.AreEqual("System.Collections.Generic.Dictionary<System.String, System.Int32>.Enumerator",
                            extractor.GetName(typeof(Dictionary <string, int> .Enumerator), true));

            CollectionAssert.AreEquivalent(new[] {
                typeof(IDictionary <,>).Namespace,
                typeof(string).Namespace
            }, extractor.Namespaces.ToArray());
        }