Created
September 2, 2010 14:42
-
-
Save jmarnold/562377 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
[TestFixture] | |
public class UserTester | |
{ | |
[TestFixtureSetUp] | |
public void FixtureSetUp() | |
{ | |
Integrator.Initialize(x => x.AddRegistry<HelloWorldStructureMapRegistry>(), new HelloWorldIntegratorRegistry()); | |
} | |
[Test] | |
public void user_can_be_persisted() | |
{ | |
var result = Integrator.GenerateAndPersist(new AddBlogPostCommand()); | |
var retrievedUser = Integrator.Retrieve<User>(result.Entity.UserId); | |
retrievedUser | |
.FirstName | |
.ShouldEqual(result.Entity.FirstName); | |
retrievedUser | |
.LastName | |
.ShouldEqual(result.Entity.LastName); | |
retrievedUser | |
.Posts | |
.ShouldHaveCount(1); | |
} | |
#region Nested Type: AddBlogPostCommand | |
public class AddBlogPostCommand : IDomainCommand<User> | |
{ | |
public void Execute(User entity) | |
{ | |
var post = new BlogPost(entity); | |
Integrator.Fill(post); | |
entity.AddPost(post); | |
} | |
} | |
#endregion | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment