diff options
Diffstat (limited to 'mdoc/mdoc.Test/SampleClasses')
9 files changed, 686 insertions, 0 deletions
diff --git a/mdoc/mdoc.Test/SampleClasses/ApplePlatformEnum.cs b/mdoc/mdoc.Test/SampleClasses/ApplePlatformEnum.cs new file mode 100644 index 00000000..490c7978 --- /dev/null +++ b/mdoc/mdoc.Test/SampleClasses/ApplePlatformEnum.cs @@ -0,0 +1,48 @@ +using System; + +namespace ObjCRuntime +{ + [Flags] + public enum Platform : ulong + { + None = 0, + iOS_2_0 = 0x0000000000020000, + iOS_2_2 = 0x0000000000020200, + iOS_3_0 = 0x0000000000030000, + iOS_3_1 = 0x0000000000030100, + iOS_3_2 = 0x0000000000030200, + iOS_4_0 = 0x0000000000040000, + iOS_4_1 = 0x0000000000040100, + iOS_4_2 = 0x0000000000040200, + iOS_4_3 = 0x0000000000040300, + iOS_5_0 = 0x0000000000050000, + iOS_5_1 = 0x0000000000050100, + iOS_6_0 = 0x0000000000060000, + iOS_6_1 = 0x0000000000060100, + iOS_7_0 = 0x0000000000070000, + iOS_7_1 = 0x0000000000070100, + iOS_8_0 = 0x0000000000080000, + iOS_8_1 = 0x0000000000080100, + iOS_8_2 = 0x0000000000080200, + iOS_8_3 = 0x0000000000080300, + Mac_10_0 = 0x000A000000000000, + Mac_10_1 = 0x000A010000000000, + Mac_10_2 = 0x000A020000000000, + Mac_10_3 = 0x000A030000000000, + Mac_10_4 = 0x000A040000000000, + Mac_10_5 = 0x000A050000000000, + Mac_10_6 = 0x000A060000000000, + Mac_10_7 = 0x000A070000000000, + Mac_10_8 = 0x000A080000000000, + Mac_10_9 = 0x000A090000000000, + Mac_10_10 = 0x000A0A0000000000, + iOS_Version = 0x0000000000FFFFFF, + Mac_Version = 0x00FFFFFF00000000, + Mac_Arch32 = 0x0100000000000000, + Mac_Arch64 = 0x0200000000000000, + Mac_Arch = 0xFF00000000000000, + iOS_Arch32 = 0x0000000001000000, + iOS_Arch64 = 0x0000000002000000, + iOS_Arch = 0x00000000FF000000 + } +} diff --git a/mdoc/mdoc.Test/SampleClasses/AttributeDataTypeAttribute.cs b/mdoc/mdoc.Test/SampleClasses/AttributeDataTypeAttribute.cs new file mode 100644 index 00000000..ce49992e --- /dev/null +++ b/mdoc/mdoc.Test/SampleClasses/AttributeDataTypeAttribute.cs @@ -0,0 +1,57 @@ +using System; + +namespace mdoc.Test.SampleClasses +{ + public class AttributeDataTypeAttribute : Attribute + { + public object ObjectType { get; set; } + + public Type TypeType { get; set; } + + public bool BoolType { get; set; } + + public SByte SByteType { get; set; } + + public Byte ByteType { get; set; } + + public Int16 Int16Type { get; set; } + + public UInt16 UInt16Type { get; set; } + + public Int32 Int32Type { get; set; } + + public Int32? NullableOfInt32Type { get; set; } + + public UInt32 UInt32Type { get; set; } + + public Int64 Int64Type { get; set; } + + public UInt64 UInt64Type { get; set; } + + public Single SingleType { get; set; } + + public Double DoubleType { get; set; } + + public char CharType { get; set; } + + public string StringType { get; set; } + + public int[] ArrayOfIntType { get; set; } + + public ConsoleColor EnumType { get; set; } + + public SomeNestedTypes.NestedEnum NestedEnumType { get; set; } + + public SomeNestedTypes.NestedFlagsEnum NestedFlagsEnumType { get; set; } + + public SomeFlagsEnum DuplicateFlagsEnumType { get; set; } + + public AttributeTargets FlagsEnumType { get; set; } + + public NotApplyAttributeValidFlagsEnum NotApplyAttributeFlagsEnumType { get; set; } + + public NotApplyAttributeInvalidFlagsEnum NotApplyAttributeInvalidFlagsEnumType { get; set; } + + public ObjCRuntime.Platform ApplePlatformFlagsEnumType { get; set; } + } +} diff --git a/mdoc/mdoc.Test/SampleClasses/GuidClass.cs b/mdoc/mdoc.Test/SampleClasses/GuidClass.cs new file mode 100644 index 00000000..9e355b19 --- /dev/null +++ b/mdoc/mdoc.Test/SampleClasses/GuidClass.cs @@ -0,0 +1,17 @@ +using System; + +namespace mdoc.Test.SampleClasses +{ + public class GuidClass + { + private readonly Guid _guid = Guid.Empty; + + private GuidClass() { this._guid = Guid.NewGuid(); } + + public GuidClass (Guid guid) { this._guid = guid; } + + public static Guid CreateNewGuid() { return new Guid(); } + public bool ObjectIndentical(Guid objGuid1, Guid objGuid2) { return objGuid1 == objGuid2; } + public bool IsUnique(Guid guid) { return guid == _guid; } + } +} diff --git a/mdoc/mdoc.Test/SampleClasses/NotApplyAttributeInvalidFlagsEnum.cs b/mdoc/mdoc.Test/SampleClasses/NotApplyAttributeInvalidFlagsEnum.cs new file mode 100644 index 00000000..e0ad0455 --- /dev/null +++ b/mdoc/mdoc.Test/SampleClasses/NotApplyAttributeInvalidFlagsEnum.cs @@ -0,0 +1,10 @@ +namespace mdoc.Test.SampleClasses +{ + public enum NotApplyAttributeInvalidFlagsEnum + { + None = 0, + Read = 1, + Write = 2, + ReadWrite = 3 + } +} diff --git a/mdoc/mdoc.Test/SampleClasses/NotApplyAttributeValidFlagsEnum.cs b/mdoc/mdoc.Test/SampleClasses/NotApplyAttributeValidFlagsEnum.cs new file mode 100644 index 00000000..de4fa77e --- /dev/null +++ b/mdoc/mdoc.Test/SampleClasses/NotApplyAttributeValidFlagsEnum.cs @@ -0,0 +1,12 @@ +namespace mdoc.Test.SampleClasses +{ + public enum NotApplyAttributeValidFlagsEnum + { + None = 0, + Assembly = 1, + Module = 2, + Class = 4, + Struct = 8, + Enum = 16 + } +} diff --git a/mdoc/mdoc.Test/SampleClasses/SomeAttribute.cs b/mdoc/mdoc.Test/SampleClasses/SomeAttribute.cs new file mode 100644 index 00000000..2b7850ce --- /dev/null +++ b/mdoc/mdoc.Test/SampleClasses/SomeAttribute.cs @@ -0,0 +1,450 @@ +using Mono.Cecil; +using System; +using System.Collections.Generic; + +namespace mdoc.Test.SampleClasses +{ + public class SomeAttribute + { + [AttributeDataType(TypeType = typeof(TypeReference))] + public void PropertyTypeType() + { + } + + [AttributeDataType(TypeType = null)] + public void PropertyTypeTypeWithNull() + { + } + + [AttributeDataType(TypeType = typeof(SomeNestedTypes.NestedClass))] + public void PropertyTypeTypeWithNestedType() + { + } + + [AttributeDataType(TypeType = typeof(ICollection<>))] + public void PropertyTypeTypeWithUnboundCollection() + { + } + + [AttributeDataType(TypeType = typeof(ICollection<int>))] + public void PropertyTypeTypeWithCollectionOfInt() + { + } + + [AttributeDataType(TypeType = typeof(IDictionary<,>))] + public void PropertyTypeTypeWithUnboundDictionary() + { + } + + [AttributeDataType(TypeType = typeof(IDictionary<int, int>))] + public void PropertyTypeTypeWithDictionaryOfInt() + { + } + + [AttributeDataType(TypeType = typeof(SomeGenericClass<>))] + public void PropertyTypeTypeWithUnboundCustomGenericType() + { + } + + [AttributeDataType(TypeType = typeof(SomeGenericClass<int>))] + public void PropertyTypeTypeWithCustomGenericTypeOfInt() + { + } + + [AttributeDataType(TypeType = typeof(SomeNestedTypes.NestedGenericType<>))] + public void PropertyTypeTypeWithUnboundNestedGenericType() + { + } + + [AttributeDataType(TypeType = typeof(SomeNestedTypes.NestedGenericType<int>))] + public void PropertyTypeTypeWithNestedGenericTypeOfInt() + { + } + + + [AttributeDataType(TypeType = typeof(SomeNestedTypes.NestedGenericType<>.InnerNestedGenericType<>))] + public void PropertyTypeTypeWithUnboundInnerNestedGenericType() + { + } + + [AttributeDataType(TypeType = typeof(SomeNestedTypes.NestedGenericType<string>.InnerNestedGenericType<int>))] + public void PropertyTypeTypeWithInnerNestedGenericTypeOfInt() + { + } + + [AttributeDataType(BoolType = true)] + public void PropertyBoolType() + { + } + + [AttributeDataType(SByteType = SByte.MinValue)] + public void PropertySByteType() + { + } + + [AttributeDataType(ByteType = Byte.MaxValue)] + public void PropertyByteType() + { + } + + [AttributeDataType(Int16Type = Int16.MinValue)] + public void PropertyInt16Type() + { + } + + [AttributeDataType(UInt16Type = UInt16.MaxValue)] + public void PropertyUInt16Type() + { + } + + [AttributeDataType(Int32Type = Int32.MinValue)] + public void PropertyInt32Type() + { + } + + [AttributeDataType(UInt32Type = UInt32.MaxValue)] + public void PropertyUInt32Type() + { + } + + [AttributeDataType(Int64Type = Int64.MinValue)] + public void PropertyInt64Type() + { + } + + [AttributeDataType(UInt64Type = UInt64.MaxValue)] + public void PropertyUInt64Type() + { + } + + [AttributeDataType(SingleType = Single.MinValue)] + public void PropertySingleType() + { + } + + [AttributeDataType(DoubleType = Double.MinValue)] + public void PropertyDoubleType() + { + } + + [AttributeDataType(CharType = 'C')] + public void PropertyCharType() + { + } + + [AttributeDataType(StringType = "This is a string argument.")] + public void PropertyStringType() + { + } + + [AttributeDataType(StringType = null)] + public void PropertyStringTypeWithNull() + { + } + + [AttributeDataType(StringType = "")] + public void PropertyStringTypeWithEmptyString() + { + } + + [AttributeDataType(ArrayOfIntType = new[] { 0, 0, 7 })] + public void PropertyArrayOfIntType() + { + } + + [AttributeDataType(ArrayOfIntType = null)] + public void PropertyArrayOfIntTypeWithNull() + { + } + + [AttributeDataType(EnumType = ConsoleColor.Red)] + public void PropertyEnumType() + { + } + + [AttributeDataType(EnumType = (ConsoleColor)int.MaxValue)] + public void PropertyEnumTypeWithUnknownValue() + { + } + + [AttributeDataType(NestedEnumType = SomeNestedTypes.NestedEnum.Read)] + public void PropertyNestedEnumType() + { + } + + [AttributeDataType(NestedEnumType = (SomeNestedTypes.NestedEnum)int.MaxValue)] + public void PropertyNestedEnumTypeWithUnknownValue() + { + } + + [AttributeDataType(FlagsEnumType = AttributeTargets.Class | AttributeTargets.Enum)] + public void PropertyFlagsEnumType() + { + } + + [AttributeDataType(FlagsEnumType = AttributeTargets.All)] + public void PropertyFlagsEnumTypeWithAllValue() + { + } + + [AttributeDataType(FlagsEnumType = (AttributeTargets)0)] + public void PropertyFlagsEnumTypeWithUndefineValueZero() + { + } + + [AttributeDataType(DuplicateFlagsEnumType = SomeFlagsEnum.Read | SomeFlagsEnum.Write | SomeFlagsEnum.Open)] + public void PropertyDuplicateFlagsEnumTypeWithCombinationValue() + { + } + + [AttributeDataType(NestedFlagsEnumType = SomeNestedTypes.NestedFlagsEnum.Class | SomeNestedTypes.NestedFlagsEnum.Enum)] + public void PropertyNestedFlagsEnumType() + { + } + + [AttributeDataType(NestedFlagsEnumType = (SomeNestedTypes.NestedFlagsEnum)0)] + public void PropertyNestedFlagsEnumTypeWithUndefineValueZero() + { + } + + [AttributeDataType(NotApplyAttributeFlagsEnumType = NotApplyAttributeValidFlagsEnum.Class | NotApplyAttributeValidFlagsEnum.Enum)] + public void PropertyFlagsEnumTypeWithNotApplyAttributeValidTypeAndCombinationValue() + { + } + + [AttributeDataType(NotApplyAttributeFlagsEnumType = NotApplyAttributeValidFlagsEnum.Class)] + public void PropertyFlagsEnumTypeWithNotApplyAttributeValidTypeAndSingleValue() + { + } + + [AttributeDataType(NotApplyAttributeInvalidFlagsEnumType = (NotApplyAttributeInvalidFlagsEnum)5)] + public void PropertyFlagsEnumTypeWithNotApplyAttributeInvalidTypeAndUnknownCombinationValue() + { + } + + [AttributeDataType(ApplePlatformFlagsEnumType = ObjCRuntime.Platform.Mac_10_8 | ObjCRuntime.Platform.Mac_Arch64)] + public void PropertyFlagsEnumTypeWithApplePlatformType() + { + } + + [AttributeDataType(ApplePlatformFlagsEnumType = ObjCRuntime.Platform.None)] + public void PropertyFlagsEnumTypeWithApplePlatformAndNoneValue() + { + } + + [AttributeDataType(ObjectType = null)] + public void PropertyObjectWithNull() + { + } + + [AttributeDataType(ObjectType = typeof(TypeReference))] + public void PropertyObjectWithTypeType() + { + } + + [AttributeDataType(ObjectType = typeof(SomeNestedTypes.NestedClass))] + public void PropertyObjectWithNestedTypeType() + { + } + + [AttributeDataType(ObjectType = typeof(ICollection<>))] + public void PropertyObjectWithUnboundCollectionType() + { + } + + [AttributeDataType(ObjectType = typeof(ICollection<int>))] + public void PropertyObjectWithCollectionTypeOfInt() + { + } + + [AttributeDataType(ObjectType = typeof(IDictionary<,>))] + public void PropertyObjectWithUnboundDictionaryType() + { + } + + [AttributeDataType(ObjectType = typeof(IDictionary<int, int>))] + public void PropertyObjectWithDictionaryTypeOfInt() + { + } + + [AttributeDataType(ObjectType = typeof(SomeGenericClass<>))] + public void PropertyObjectWithUnboundCustomGenericType() + { + } + + [AttributeDataType(ObjectType = typeof(SomeGenericClass<int>))] + public void PropertyObjectWithCustomGenericTypeOfInt() + { + } + + [AttributeDataType(ObjectType = typeof(SomeNestedTypes.NestedGenericType<>))] + public void PropertyObjectWithUnboundNestedGenericType() + { + } + + [AttributeDataType(ObjectType = typeof(SomeNestedTypes.NestedGenericType<int>))] + public void PropertyObjectWithNestedGenericTypeOfInt() + { + } + + [AttributeDataType(ObjectType = typeof(SomeNestedTypes.NestedGenericType<>.InnerNestedGenericType<>))] + public void PropertyObjectWithUnboundInnerNestedGenericType() + { + } + + [AttributeDataType(ObjectType = typeof(SomeNestedTypes.NestedGenericType<string>.InnerNestedGenericType<int>))] + public void PropertyObjectWithInnerNestedGenericTypeOfInt() + { + } + + [AttributeDataType(ObjectType = true)] + public void PropertyObjectWithBoolType() + { + } + + [AttributeDataType(ObjectType = SByte.MinValue)] + public void PropertyObjectWithSByteType() + { + } + + [AttributeDataType(ObjectType = Byte.MaxValue)] + public void PropertyObjectWithByteType() + { + } + + [AttributeDataType(ObjectType = Int16.MinValue)] + public void PropertyObjectWithInt16Type() + { + } + + [AttributeDataType(ObjectType = UInt16.MaxValue)] + public void PropertyObjectWithUInt16Type() + { + } + + [AttributeDataType(ObjectType = Int32.MinValue)] + public void PropertyObjectWithInt32Type() + { + } + + [AttributeDataType(ObjectType = UInt32.MaxValue)] + public void PropertyObjectWithUInt32Type() + { + } + + [AttributeDataType(ObjectType = Int64.MinValue)] + public void PropertyObjectWithInt64Type() + { + } + + [AttributeDataType(ObjectType = UInt64.MaxValue)] + public void PropertyObjectWithUInt64Type() + { + } + + [AttributeDataType(ObjectType = Single.MinValue)] + public void PropertyObjectWithSingleType() + { + } + + [AttributeDataType(ObjectType = Double.MinValue)] + public void PropertyObjectWithDoubleType() + { + } + + [AttributeDataType(ObjectType = 'C')] + public void PropertyObjectWithCharType() + { + } + + [AttributeDataType(ObjectType = "This is a string argument.")] + public void PropertyObjectWithStringType() + { + } + + [AttributeDataType(ObjectType = "")] + public void PropertyObjectWithStringTypeAndEmptyString() + { + } + + [AttributeDataType(ObjectType = new[] { 0, 0, 7 })] + public void PropertyObjectWithArrayOfIntType() + { + } + + [AttributeDataType(ObjectType = ConsoleColor.Red)] + public void PropertyObjectWithEnumType() + { + } + + [AttributeDataType(ObjectType = (ConsoleColor)int.MaxValue)] + public void PropertyObjectWithEnumTypeAndUnknownValue() + { + } + + [AttributeDataType(ObjectType = SomeNestedTypes.NestedEnum.Read)] + public void PropertyObjectWithNestedEnumType() + { + } + + [AttributeDataType(ObjectType = (SomeNestedTypes.NestedEnum)int.MaxValue)] + public void PropertyObjectWithNestedEnumTypeAndUnknownValue() + { + } + + [AttributeDataType(ObjectType = AttributeTargets.Class | AttributeTargets.Enum)] + public void PropertyObjectWithFlagsEnumType() + { + } + + [AttributeDataType(ObjectType = AttributeTargets.All)] + public void PropertyObjectWithFlagsEnumTypeAndAllValue() + { + } + + [AttributeDataType(ObjectType = (AttributeTargets)0)] + public void PropertyObjectWithFlagsEnumTypeAndUndefineValueZero() + { + } + + [AttributeDataType(ObjectType = SomeFlagsEnum.Read | SomeFlagsEnum.Write | SomeFlagsEnum.Open)] + public void PropertyObjectWithDuplicateFlagsEnumTypeAndCombinationValue() + { + } + + [AttributeDataType(ObjectType = SomeNestedTypes.NestedFlagsEnum.Class | SomeNestedTypes.NestedFlagsEnum.Enum)] + public void PropertyObjectWithNestedFlagsEnumType() + { + } + + [AttributeDataType(ObjectType = (SomeNestedTypes.NestedFlagsEnum)0)] + public void PropertyObjectWithNestedFlagsEnumTypeAndUndefineValueZero() + { + } + + [AttributeDataType(ObjectType = NotApplyAttributeValidFlagsEnum.Class | NotApplyAttributeValidFlagsEnum.Enum)] + public void PropertyObjectWithNotApplyAttributeValidFlagsEnumTypeAndCombinationValue() + { + } + + [AttributeDataType(ObjectType = NotApplyAttributeValidFlagsEnum.Class)] + public void PropertyObjectWithNotApplyAttributeValidFlagsEnumTypeAndSingleValue() + { + } + + [AttributeDataType(ObjectType = (NotApplyAttributeInvalidFlagsEnum)5)] + public void PropertyObjectWithNotApplyAttributeInvalidFlagsEnumTypeAndUnknownCombinationValue() + { + } + + [AttributeDataType(ObjectType = ObjCRuntime.Platform.Mac_10_8 | ObjCRuntime.Platform.Mac_Arch64)] + public void PropertyObjectWithApplePlatformFlagsEnumType() + { + } + + [AttributeDataType(ObjectType = ObjCRuntime.Platform.None)] + public void PropertyObjectWithApplePlatformFlagsEnumTypeAndNoneValue() + { + } + } +} diff --git a/mdoc/mdoc.Test/SampleClasses/SomeFlagsEnum.cs b/mdoc/mdoc.Test/SampleClasses/SomeFlagsEnum.cs new file mode 100644 index 00000000..a95365d3 --- /dev/null +++ b/mdoc/mdoc.Test/SampleClasses/SomeFlagsEnum.cs @@ -0,0 +1,14 @@ +using System; + +namespace mdoc.Test.SampleClasses +{ + [Flags] + public enum SomeFlagsEnum + { + Read = 1, + Write = 2, + ReadWrite = Read | Write, + Open = 4, + Close = 8 + } +} diff --git a/mdoc/mdoc.Test/SampleClasses/SomeIteratorStateMachine.cs b/mdoc/mdoc.Test/SampleClasses/SomeIteratorStateMachine.cs new file mode 100644 index 00000000..3dbf6032 --- /dev/null +++ b/mdoc/mdoc.Test/SampleClasses/SomeIteratorStateMachine.cs @@ -0,0 +1,44 @@ +using System; +using System.Collections; +using System.Collections.Generic; + +namespace mdoc.Test.SampleClasses +{ + public class SomeIteratorStateMachine<TKey, TValue> : IEnumerable<KeyValuePair<TKey, TValue>> + { + public IEnumerator<KeyValuePair<TKey, TValue>> GetEnumerator() + { + yield return new KeyValuePair<TKey, TValue>(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + throw new NotImplementedException(); + } + + public IEnumerator<KeyValuePair<T1, T2>> WithParameterType<T1, T2>() + { + yield return new KeyValuePair<T1, T2>(); + + } + + public class SomeNestedIteratorStateMachine<NestedTKey, NestedTValue> : IEnumerable<KeyValuePair<NestedTKey, NestedTValue>> + { + public IEnumerator<KeyValuePair<NestedTKey, NestedTValue>> GetEnumerator() + { + yield return new KeyValuePair<NestedTKey, NestedTValue>(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + throw new NotImplementedException(); + } + + public IEnumerator<KeyValuePair<NestedT1, NestedT2>> WithParameterType<NestedT1, NestedT2>() + { + yield return new KeyValuePair<NestedT1, NestedT2>(); + + } + } + } +} diff --git a/mdoc/mdoc.Test/SampleClasses/SomeNestedTypes.cs b/mdoc/mdoc.Test/SampleClasses/SomeNestedTypes.cs new file mode 100644 index 00000000..1c8f332e --- /dev/null +++ b/mdoc/mdoc.Test/SampleClasses/SomeNestedTypes.cs @@ -0,0 +1,34 @@ +using System; + +namespace mdoc.Test.SampleClasses +{ + public class SomeNestedTypes + { + public class NestedClass + { + } + + public class NestedGenericType<T> + { + public class InnerNestedGenericType<T1> + { + } + } + + public enum NestedEnum + { + Read = 1, + Write = 2, + } + + [Flags] + public enum NestedFlagsEnum + { + Assembly = 1, + Module = 2, + Class = 4, + Struct = 8, + Enum = 16 + } + } +} |