anchor.diff:      [<ThriftField(1s, false, "Field")>]
       member val Field = System.Nullable() with get, set
   
  +let ok (value: 'a) typeId fieldData =
  +    let typ = 
  +        makeClass 
  +            [ <@ ThriftStructAttribute("Struct") @> ] 
  +            [ "Field", typeof<'a>, [ <@ ThriftFieldAttribute(1s, true, "Field") @> ] ]
  +    let inst = System.Activator.CreateInstance(typ)
  +    typ.GetProperty("Field").SetValue(inst, value)
  +
  +    let data = 
  +        [StructHeader "Struct"; FieldHeader (1s, "Field", tid typeId)]
  +      @ fieldData 
  +      @ [FieldEnd; FieldStop; StructEnd]
  +
  +    let m = MemoryProtocol()
  +    write m inst
  +    m.WrittenValues <=> data
   
   let (==>) obj data =
       let m = MemoryProtocol()
  
positive.code: open System.Collections.Generic
  open ThriftSharp
  
  [<ThriftStruct("OneField"); AllowNullLiteral>]
  type StructWithOneField() =
      [<ThriftField(1s, true, "Field")>]
      member val Field = 0 with get, set
  
  [<ThriftStruct("ManyPrimitiveFields")>]
  type StructWithManyPrimitiveFields() =
      [<ThriftField(1s, true, "BoolField")>]
      member val Bool = true with get, set
      [<ThriftField(2s, true, "SByteField")>]
      member val SByte = 1y with get, set
      [<ThriftField(3s, true, "DoubleField")>]
      member val Double = 1.0 with get, set
      [<ThriftField(4s, true, "Int16Field")>]
      member val Int16 = 1s with get, set
      [<ThriftField(5s, true, "Int32Field")>]
      member val Int32 = 1 with get, set
      [<ThriftField(6s, true, "Int64Field")>]
      member val Int64 = 1L with get, set
      [<ThriftField(7s, false, "StringField")>]
      member val String = "abc" with get, set
      [<ThriftField(8s, false, "BinaryField")>]
      member val Binary = [| 1y |] with get, set
  
  [<ThriftStruct("CollectionFields")>]
  type StructWithCollectionFields() =
      [<ThriftField(1s, true, "ListField")>]
      member val List = List<int>() with get, set
      [<ThriftField(2s, true, "SetField")>]
      member val Set = HashSet<int>() with get, set
      [<ThriftField(3s, true, "MapField")>]
      member val Map = Dictionary<int, string>() with get, set
  
  [<ThriftStruct("StructField")>]
  type StructWithStructField() =
      [<ThriftField(1s, true, "StructField")>]
      member val Struct = null :> StructWithOneField with get, set
  
  [<ThriftEnum>]
  type Enum =
      | A = 1
      | B = 3
  
  [<ThriftStruct("EnumFields")>]
  type StructWithEnumFields() =
      [<ThriftField(1s, true, "Field1")>]
      member val Field1 = Enum.A with get, set
      [<ThriftField(2s, false, "Field2")>]
      member val Field2 = nullable Enum.A with get, set
  
  [<ThriftStruct("ArrayFields")>]
  type StructWithArrayFields() =
      [<ThriftField(1s, true, "Field1")>]
      member val Field1 = [| 1 |] with get, set
      [<ThriftField(2s, true, "Field2")>]
      member val Field2 = [| 2 |] with get, set
  
  [<ThriftStruct("ConvertingField")>]
  type StructWithConvertingField() =
  
negative.code: 
  [<TestContainer>]
  type __() =
      // Primitive fields
      [<Test>] member __.Bool()   = ok true          2 [Bool true]
      [<Test>] member __.SByte()  = ok 1y            3 [SByte 1y]
      [<Test>] member __.Double() = ok 1.0           4 [Double 1.0]
      [<Test>] member __.Int16()  = ok 1s            6 [Int16 1s]
      [<Test>] member __.Int32()  = ok 1             8 [Int32 1]
      [<Test>] member __.Int64()  = ok 1L           10 [Int64 1L]
      [<Test>] member __.String() = ok "x"          11 [String "x"]
      [<Test>] member __.Binary() = ok [| 1y |]     11 [Binary [| 1y |]]
      [<Test>] member __.Enum()   = ok SimpleEnum.A  8 [Int32 1]
  
      // Collection fields
      [<Test>] member __.List()  = ok (List [1])     15 [ListHeader (1, tid 8); Int32 1; ListEnd]
      [<Test>] member __.Set()   = ok (HashSet [1])  14 [SetHeader (1, tid 8); Int32 1; SetEnd]
      [<Test>] member __.Map()   = ok (dict [1, 1L]) 13 [MapHeader (1, tid 8, tid 10); Int32 1; Int64 1L; MapEnd]
      [<Test>] member __.Array() = ok [| 1 |]        15 [ListHeader (1, tid 8); Int32 1; ListEnd]
  
      // Struct fields
      [<Test>] member __.Struct() = ok (SimpleStruct()) 12 [StructHeader "SimpleStruct"; FieldHeader (1s, "Field", tid 8); Int32 1; FieldEnd; FieldStop; StructEnd]
       
  
      // Other, more specialized, tests
      [<Test>]
      member __.``Error on required but unset struct field``() =
          throws<ThriftSerializationException> (StructWithStructField())
  
      [<Test>]
      member __.``UnixDate converter``() =
  