public Apply ( BsonMemberMap memberMap ) : void | ||
memberMap | BsonMemberMap | The member map. |
return | void |
public void TestConvention(BsonType value) { var convention = new EnumRepresentationConvention(value); var classMap = new BsonClassMap<TestClass>(); var nonEnumMemberMap = classMap.MapMember(x => x.NonEnum); var defaultEnumMemberMap = classMap.MapMember(x => x.DefaultEnum); var changedEnumMemberMap = classMap.MapMember(x => x.ChangedRepresentationEnum); convention.Apply(nonEnumMemberMap); convention.Apply(changedEnumMemberMap); Assert.AreEqual(value, ((IRepresentationConfigurable)(changedEnumMemberMap.GetSerializer())).Representation); }
public void TestConvention(BsonType value) { var convention = new EnumRepresentationConvention(value); var classMap = new BsonClassMap<TestClass>(); var nonEnumMemberMap = classMap.MapMember(x => x.NonEnum); var defaultEnumMemberMap = classMap.MapMember(x => x.DefaultEnum); var changedEnumMemberMap = classMap.MapMember(x => x.ChangedRepresentationEnum); convention.Apply(nonEnumMemberMap); convention.Apply(changedEnumMemberMap); Assert.IsNull(nonEnumMemberMap.SerializationOptions); Assert.IsNull(defaultEnumMemberMap.SerializationOptions); Assert.AreEqual(value, ((RepresentationSerializationOptions)changedEnumMemberMap.SerializationOptions).Representation); }
public void TestConventionOverride() { var int64Convention = new EnumRepresentationConvention(BsonType.Int64); var strConvention = new EnumRepresentationConvention(BsonType.String); var classMap = new BsonClassMap<TestClass>(); var memberMap = classMap.MapMember(x => x.ChangedRepresentationEnum); int64Convention.Apply(memberMap); strConvention.Apply(memberMap); Assert.AreEqual(BsonType.String, ((IRepresentationConfigurable)(memberMap.GetSerializer())).Representation); }