コード例 #1
0
        private IEnumerable <ITypeDescription> CreateSingleIntFieldClass()
        {
            var stringType = KnownType.Create(typeof(int));
            var type       = SimpleClassDescription.Create(TestMetaData.SingleFieldType(),
                                                           f => TestMetaData.CreateField(stringType));

            return(new[] { type, stringType });
        }
コード例 #2
0
        internal static IEnumerable <ITypeDescription> TypeWithGenericList()
        {
            var stringList = KnownType.Create(typeof(List <string>));
            var type       = SimpleClassDescription.Create(TestMetaData.SingleFieldType(),
                                                           f => TestMetaData.CreateField(stringList));

            return(new[] { type, stringList });
        }
コード例 #3
0
        private IEnumerable <ITypeDescription> SubClassType()
        {
            var baseClasses = TestMetaData.CreateSingleFieldClass();
            var intType     = KnownType.Create(typeof(int));
            var baseClass   = baseClasses.Single(b => !b.TryResolveType(TestUtils.FindNothingTypeResolver).HasValue);
            var subType     = SimpleClassDescription.Create(
                TypeName.Create("ANamespace.SubClass", TestMetaData.AssemblyName), Maybe.From(baseClass),
                f => TestMetaData.CreateField("subField", intType));

            return(baseClasses.Concat(new[] { intType, subType }));
        }
コード例 #4
0
        internal static IEnumerable <ITypeDescription> GenericType()
        {
            var stringList       = KnownType.Create(typeof(List <string>));
            var stringType       = typeof(string);
            var genericArguments = GenericArg(stringType);
            var type             = SimpleClassDescription.Create(TypeName.Create(TestMetaData.SingleFieldTypeName + "`1",
                                                                                 TestMetaData.AssemblyName, genericArguments),
                                                                 f => TestMetaData.CreateField(stringList));

            return(new[] { type, stringList });
        }
コード例 #5
0
        private static IEnumerable <ITypeDescription> TwoGenericInstances()
        {
            var stringList        = KnownType.Create(typeof(List <string>));
            var stringType        = typeof(string);
            var stringGenericArgs = GenericArg(stringType);
            var stringInstance    = SimpleClassDescription.Create(TypeName.Create(TestMetaData.SingleFieldTypeName, TestMetaData.AssemblyName, stringGenericArgs),
                                                                  f => TestMetaData.CreateField(stringList));

            var intList        = KnownType.Create(typeof(List <int>));
            var intType        = typeof(int);
            var intGenericArgs = GenericArg(intType);
            var intInstance    = SimpleClassDescription.Create(TypeName.Create(TestMetaData.SingleFieldTypeName, TestMetaData.AssemblyName, intGenericArgs),
                                                               f => TestMetaData.CreateField(intList));

            return(new[] { stringInstance, intInstance, stringList, intList });
        }