コード例 #1
0
        public void 泛型类_已定义参数类型()
        {
            Type type = typeof(Model_泛型1 <int, double, int>);

            Assert.Equal("<int, double, int>", "<" + string.Join(",", GenericeAnalysis.GetGenriceParams(type)) + ">");
            //Assert.Equal("<System.Int32, System.Double, System.Int32>", GenericeAnalysis.Analysis(type, true));
        }
コード例 #2
0
        public void 泛型类_未定义参数类型()
        {
            Type type = typeof(Model_泛型1 <, ,>);

            Assert.Equal("<, , >", "<" + string.Join(",", GenericeAnalysis.GetGenriceParams(type)) + ">");
            //Assert.Equal("<T1, T2, T3>", GenericeAnalysis.Analysis(type, true));
        }
コード例 #3
0
        public void 子类非泛型_父类泛型已定义解析()
        {
            Type type = new Model_泛型3().GetType();

            Assert.Equal("<int, double, int>", "<" + string.Join(",", GenericeAnalysis.GetGenriceParams(type)) + ">");
            //Assert.Equal("<System.Int32, System.Double, System.Int32>", "<"+string.Join(",", GenericeAnalysis.GetGenriceParams(type))+">");
        }
コード例 #4
0
        public void 子类非泛型_父类泛型已定义解析()
        {
            Type type = new Model_泛型3().GetType();

            Assert.Equal("<>", "<" + string.Join(",", GenericeAnalysis.GetGenriceParams(type)) + ">");
            Assert.Equal("<int,double,int>", "<" + string.Join(",", GenericeAnalysis.GetGenriceParams(typeof(Model_泛型1 <int, double, int>))) + ">");
        }
コード例 #5
0
        public void 泛型类_泛型父类解析()
        {
            Model_泛型2 <int, double, int> model_ = new Model_泛型2 <int, double, int>();
            Type type = model_.GetType();

            Assert.Equal("<int, double, int>", "<" + string.Join(",", GenericeAnalysis.GetGenriceParams(type)) + ">");
            //Assert.Equal("<System.Int32, System.Double, System.Int32>", GenericeAnalysis.Analysis(type.BaseType, true));
        }
コード例 #6
0
        public void 长嵌套泛型参数解析()
        {
            Type type = typeof(Model_泛型1 <int, List <int>, Dictionary <List <int>, Dictionary <int, List <int> > > >);

            Assert.Equal("<int, List<int>, Dictionary<List<int>, Dictionary<int, List<int>>>>", "<" + string.Join(",", GenericeAnalysis.GetGenriceParams(type)) + ">");
            //Assert.Equal(@"<System.Int32, System.Collections.Generic.List<System.Int32>, System.Collections.Generic.Dictionary<System.Collections.Generic.List<System.Int32>, System.Collections.Generic.Dictionary<System.Int32, System.Collections.Generic.List<System.Int32>>>>", GenericeAnalysis.Analysis(type, true));
        }