Created
May 28, 2013 12:13
-
-
Save craiggwilson/5662332 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using MongoDB.Bson; | |
using MongoDB.Bson.Serialization; | |
using NUnit.Framework; | |
namespace MongoDB.BsonUnitTests.DefaultSerializer.GGTests | |
{ | |
[TestFixture] | |
public class Mapping_a_class_without_any_public_properties_or_attributes | |
{ | |
private class A | |
{ | |
ObjectId FieldId { get; set; } | |
} | |
[Test] | |
public void Should_result_in_0_members() | |
{ | |
var mapped = BsonClassMap.RegisterClassMap<A>(cm => cm.AutoMap()); | |
mapped.Freeze(); | |
Assert.AreEqual(0, mapped.MemberMaps.Count()); | |
} | |
} | |
[TestFixture] | |
public class Mapping_a_class_with_one_public_member | |
{ | |
private class A | |
{ | |
public ObjectId FieldId { get; set; } | |
} | |
[Test] | |
public void Should_result_in_1_member_that_is_not_an_id() | |
{ | |
var mapped = BsonClassMap.RegisterClassMap<A>(cm => cm.AutoMap()); | |
mapped.Freeze(); | |
Assert.AreEqual(1, mapped.MemberMaps.Count()); | |
Assert.IsNull(mapped.IdMemberMap); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment