Created
February 5, 2009 16:28
-
-
Save stevenharman/58801 to your computer and use it in GitHub Desktop.
This file contains 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
namespace MyApplication.UnitTests.Core.Persistence | |
{ | |
[Category("MyApplicationPersistenceModel")] | |
public class when_using_the_plan_my_night_persistence_model | |
: Specification, with_auto_persistence_model | |
{ | |
private MyApplicationPersistenceModel _model; | |
public override void establish_context() | |
{ | |
_model = this.configure_model_for<MyApplicationPersistenceModel>(); | |
} | |
[Test] | |
public void should_not_map_the_entity_super_type() | |
{ | |
_model.ShouldNotMap<Entity>(); | |
} | |
[Test] | |
public void should_not_map_the_value_object_super_type() | |
{ | |
_model.ShouldNotMap(typeof(ValueObject<>)); | |
} | |
[Test] | |
public void should_map_restaurants() | |
{ | |
_model.ShouldMap<Restaurant>(); | |
} | |
[Test] | |
public void should_not_map_things_that_dont_inherit_from_a_domain_supertype() | |
{ | |
_model.ShouldNotMap<NonPersistentDomainObject>(); | |
} | |
} | |
} | |
namespace MyApplication.UnitTests.SpecHelpers | |
{ | |
public interface with_auto_persistence_model | |
{ | |
} | |
public static class WithAutoPersistenceModel | |
{ | |
public static T configure_model_for<T>(this with_auto_persistence_model spec) | |
where T : AutoPersistenceModel, new() | |
{ | |
var model = new T(); | |
model.CompileMappings(); | |
return model; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment