Skip to content

Instantly share code, notes, and snippets.

@craiggwilson
Created May 28, 2013 12:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save craiggwilson/5662332 to your computer and use it in GitHub Desktop.
Save craiggwilson/5662332 to your computer and use it in GitHub Desktop.
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