Last active
August 29, 2015 14:23
-
-
Save blazey/9c7cc7b6bcb276142d5e to your computer and use it in GitHub Desktop.
Enabling in-memory integration tests by swapping out components in tests, post normal registration of components in container
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
_bootstrap = new Bootstrap(); | |
_bootstrap.AddFacility<TestSubstituteFacility>(config => | |
{ | |
config.WithContainer(_bootstrap.Container) | |
.Substitute<IDataLakeWriter>(sub => sub.Instance(_dataLakeWriterMockery.Mock)) | |
.Substitute<ICollectorAgentDispatcher>(sub => sub.Stub()) | |
.Substitute<IBackgroundJobClient>(sub => sub.Stub()) | |
.Substitute<ISchedulesReportWriter>(sub => sub.Stub()) | |
.Substitute<IRepository<Resource>>(sub => sub.Instance(() => | |
{ | |
var store = Wireup.Init().UsingInMemoryPersistence().Build(); | |
return new Repository<Resource>(Resource.New, new UnitOfWork(), store); | |
})); | |
}); | |
_controller = _bootstrap.Container.Resolve<IController>(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment