Created
October 7, 2009 03:42
-
-
Save cbilson/203702 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 StupidExample { | |
public class CustomerGateway { | |
IUnitOfWorkManager work; | |
public CustomerGateway(IUnitOfWorkManager work) { this.work = work; } | |
public IEnumerable<Customer> GetNewCustomersSince(DateTime time) { | |
work.On("CustomerDB", session => | |
session.CreateCriteria<Customer>() | |
.Add(Expression.Gt("EffectiveDate", time)) | |
.List<Customer>()); | |
} | |
public class when_there_are_new_customers : with_the_customer_database { | |
Establish context = () => { | |
work = MockRepository.GenerateStub<IUnitOfWorkManager>(); | |
work.Stub(x => x.On("CustomerDB", Arg.Is.Anything)) | |
.Return(null) | |
.WhenCalled(invocation => invocation.ReturnValue | |
= ((Func<ISession,IEnumerable<Customer>>) invocation.Arguments[1])(session)); | |
} | |
It notices_there_are_new_customers_and_starts_dealing_with_it = () => | |
gotNewCustomers.ShouldBeTrue(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment