public void RecursiveTypeTest()
        {
            ThriftCatalog catalog = new ThriftCatalog();
            ThriftStructMetadataBuilder builder = new ThriftStructMetadataBuilder(catalog, typeof(RecursiveStruct));
            var metadata = builder.Build();

            Assert.Equal(1, metadata.Fields.Count());
        }
        public void InvalidRecursiveTypeTest()
        {
            ThriftCatalog catalog = new ThriftCatalog();

            Assert.Throws <ThriftyException>(() =>
            {
                ThriftStructMetadataBuilder builder = new ThriftStructMetadataBuilder(catalog, typeof(InvalidRecursiveStruct));
                builder.Build();
            });
        }
        public void ComplexTypeTest()
        {
            ThriftCatalog catalog = new ThriftCatalog();
            ThriftStructMetadataBuilder builder  = new ThriftStructMetadataBuilder(catalog, typeof(ComplexStruct));
            ThriftStructMetadata        metadata = builder.Build();

            var properties = typeof(ComplexStruct).GetProperties(System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.DeclaredOnly);

            Assert.Equal(properties.Length, metadata.Fields.Count());

            Assert.Equal(false, metadata.IsException);
            Assert.Equal(false, metadata.IsUnion);
            Assert.Equal(MetadataType.Struct, metadata.MetadataType);
            Assert.Equal(0, metadata.MethodInjections.Count());
            Assert.Equal(null, metadata.BuilderType);
        }
        private ThriftStructMetadata StructTest <T>()
        {
            ThriftCatalog catalog = new ThriftCatalog();
            ThriftStructMetadataBuilder builder  = new ThriftStructMetadataBuilder(catalog, typeof(T));
            ThriftStructMetadata        metadata = builder.Build();

            var properties = typeof(T).GetProperties(System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.Public);

            Assert.Equal(properties.Length, metadata.Fields.Count());

            Assert.Equal(false, metadata.IsException);
            Assert.Equal(false, metadata.IsUnion);
            Assert.Equal(MetadataType.Struct, metadata.MetadataType);
            Assert.Equal(0, metadata.MethodInjections.Count());
            Assert.Equal(null, metadata.BuilderType);
            return(metadata);
        }