private IEnumerable <ITypeDescription> CreateSingleIntFieldClass() { var stringType = KnownType.Create(typeof(int)); var type = SimpleClassDescription.Create(TestMetaData.SingleFieldType(), f => TestMetaData.CreateField(stringType)); return(new[] { type, stringType }); }
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 }); }
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 })); }
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 }); }
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 }); }