anchor.diff:                      BsonDocument("field", BsonString "0") ]
   
       let cases =
  -        [ InferedTypeTag.Number, InferedType.Primitive(typeof<int>, None, false)
  -          InferedTypeTag.String, InferedType.Primitive(typeof<string>, None, false) ]
  +        [ InferedTypeTag.Number, InferedType.Primitive (typeof<int>, None, false)
  +          InferedTypeTag.String, InferedType.Primitive (typeof<string>, None, false) ]
           |> Map.ofList
   
       let expected =
  
positive.code: 
  let shouldEqual (x:'a) (y:'a) = Assert.AreEqual(x, y)
  
  /// A collection containing just one type
  let SimpleCollection typ =
      InferedType.Collection([typeTag typ], Map.ofSeq [typeTag typ, (InferedMultiplicity.Multiple, typ)])
  
  let toRecord fields = InferedType.Record(None, fields, false)
  
  let primitiveProperty<'T> name optional =
      { Name = name
        Type = InferedType.Primitive(typeof<'T>, None, optional) }
  
  [<Test>]
  let ``Infer type of empty document``() =
      let source = BsonDocument()
      let expected = InferedType.Record(None, [], false)
      let actual = BsonInference.inferType "" source
      actual |> shouldEqual expected
  
  [<Test>]
  let ``Infer type of empty array``() =
      let source = BsonArray()
      let expected = InferedType.Collection([], Map.empty)
      let actual = BsonInference.inferType "" source
      actual |> shouldEqual expected
  
  
negative.code:                     BsonDocument([ BsonElement("field_single", single)
                                     BsonElement("field_multiple", multiple)
                                     BsonElement("field_optional_single", single) ]) ]
  
      let expected =
          [ collectionProperty<int> "field_single" InferedMultiplicity.Single
            collectionProperty<int> "field_multiple" InferedMultiplicity.Multiple
            collectionProperty<int> "field_optional_single" InferedMultiplicity.OptionalSingle ]
          |> toRecord
          |> SimpleCollection
  
      let actual = BsonInference.inferType "" source
      actual |> shouldEqual expected
  
  [<Test>]
  let ``Infer common subtype (int64[]) of numeric array fields``() =
      let singleInt = bsonArray<int> InferedMultiplicity.Single
      let singleInt64 = bsonArray<int64> InferedMultiplicity.Single
  
      let multipleInt = bsonArray<int> InferedMultiplicity.Multiple
      let multipleInt64 = bsonArray<int64> InferedMultiplicity.Multiple
  
      let source =
          BsonArray [ BsonDocument([ BsonElement("field_single", singleInt)
                                     BsonElement("field_multiple", multipleInt) ])
                      BsonDocument([ BsonElement("field_single", singleInt64)
                                     BsonElement("field_multiple", multipleInt64) ]) ]
  
      let expected =
          [ collectionProperty<int64> "field_single" InferedMultiplicity.Single
            collectionProperty<int64> "field_multiple" InferedMultiplicity.Multiple ]
          |> toRecord
          |> SimpleCollection
  
      let actual = BsonInference.inferType "" source
      actual |> shouldEqual expected
  
  [<Test>]
  let ``Infer common subtype (float[]) of numeric array fields``() =
      let singleInt = bsonArray<int> InferedMultiplicity.Single
      let singleFloat = bsonArray<float> InferedMultiplicity.Single
  
      let multipleInt = bsonArray<int> InferedMultiplicity.Multiple
      let multipleFloat = bsonArray<float> InferedMultiplicity.Multiple
  
      let source =
          BsonArray [ BsonDocument([ BsonElement("field_single", singleInt)
                                     BsonElement("field_multiple", multipleInt) ])
                      BsonDocument([ BsonElement("field_single", singleFloat)
                                     BsonElement("field_multiple", multipleFloat) ]) ]
  
      let expected =
          [ collectionProperty<float> "field_single" InferedMultiplicity.Single
            collectionProperty<float> "field_multiple" InferedMultiplicity.Multiple ]
          |> toRecord
          |> SimpleCollection
  
      let actual = BsonInference.inferType "" source
      actual |> shouldEqual expected
  
  