public void Should_register_default_dependencies_with_generics() { // Arrange IEnjoyDependenciesBuilder <IServiceProvider> enjoyDependenciesBuilder = new StubEnjoyDependenciesBuilder(); // Act enjoyDependenciesBuilder.WithEventStore <InMemoryEventStore>(); enjoyDependenciesBuilder.WithCommandDispatcher <DefaultCommandDispatcher>(); enjoyDependenciesBuilder.WithEventRouter <DefaultEventRouter>(); enjoyDependenciesBuilder.WithEventUpdateManager <DefaultEventUpdateManager>(); enjoyDependenciesBuilder.WithEventPublisher <EventPublisher>(); enjoyDependenciesBuilder.WithUnitOfWork <UnitOfWork>(); enjoyDependenciesBuilder.WithSession <Session>(); enjoyDependenciesBuilder.WithRepository <Repository>(); enjoyDependenciesBuilder.WithTextSerializer <DefaultTextSerializer>(); enjoyDependenciesBuilder.WithSnapshotSerializer <SnapshotSerializer>(); enjoyDependenciesBuilder.WithSnapshotStrategy <IntervalSnapshotStrategy>(); enjoyDependenciesBuilder.WithEventSerializer <EventSerializer>(); enjoyDependenciesBuilder.WithProjectionSerializer <ProjectionSerializer>(); enjoyDependenciesBuilder.WithLoggerFactory <NoopLoggerFactory>(); enjoyDependenciesBuilder.WithEventsMetadataService <EventsMetadataService>(); // Assert var dependencies = enjoyDependenciesBuilder.Build(); dependencies.IsValid().Should().BeTrue(); }
public void Should_register_default_dependencies_with_type() { // Arrange IEnjoyDependenciesBuilder <IServiceProvider> enjoyDependenciesBuilder = new StubEnjoyDependenciesBuilder(); // Act enjoyDependenciesBuilder.WithEventStore(typeof(InMemoryEventStore)); enjoyDependenciesBuilder.WithCommandDispatcher(typeof(DefaultCommandDispatcher)); enjoyDependenciesBuilder.WithEventRouter(typeof(DefaultEventRouter)); enjoyDependenciesBuilder.WithEventUpdateManager(typeof(DefaultEventUpdateManager)); enjoyDependenciesBuilder.WithEventPublisher(typeof(EventPublisher)); enjoyDependenciesBuilder.WithUnitOfWork(typeof(UnitOfWork)); enjoyDependenciesBuilder.WithSession(typeof(Session)); enjoyDependenciesBuilder.WithRepository(typeof(Repository)); enjoyDependenciesBuilder.WithTextSerializer(typeof(DefaultTextSerializer)); enjoyDependenciesBuilder.WithSnapshotSerializer(typeof(SnapshotSerializer)); enjoyDependenciesBuilder.WithSnapshotStrategy(typeof(IntervalSnapshotStrategy)); enjoyDependenciesBuilder.WithEventSerializer(typeof(EventSerializer)); enjoyDependenciesBuilder.WithProjectionSerializer(typeof(ProjectionSerializer)); enjoyDependenciesBuilder.WithLoggerFactory(typeof(NoopLoggerFactory)); enjoyDependenciesBuilder.WithEventsMetadataService(typeof(EventsMetadataService)); // Assert var dependencies = enjoyDependenciesBuilder.Build(); dependencies.IsValid().Should().BeTrue(); }
public void Should_register_default_dependencies_with_instance_factory() { // Arrange IEnjoyDependenciesBuilder <IServiceProvider> enjoyDependenciesBuilder = new StubEnjoyDependenciesBuilder(); // Act enjoyDependenciesBuilder.WithEventStore((c) => Mock.Of <IEventStore>()); enjoyDependenciesBuilder.WithCommandDispatcher((c) => Mock.Of <ICommandDispatcher>()); enjoyDependenciesBuilder.WithEventRouter((c) => Mock.Of <IEventRouter>()); enjoyDependenciesBuilder.WithEventUpdateManager((c) => Mock.Of <IEventUpdateManager>()); enjoyDependenciesBuilder.WithEventPublisher((c) => Mock.Of <IEventPublisher>()); enjoyDependenciesBuilder.WithUnitOfWork((c) => Mock.Of <IUnitOfWork>()); enjoyDependenciesBuilder.WithSession((c) => Mock.Of <ISession>()); enjoyDependenciesBuilder.WithRepository((c) => Mock.Of <IRepository>()); enjoyDependenciesBuilder.WithTextSerializer((c) => Mock.Of <ITextSerializer>()); enjoyDependenciesBuilder.WithSnapshotSerializer((c) => Mock.Of <ISnapshotSerializer>()); enjoyDependenciesBuilder.WithSnapshotStrategy((c) => Mock.Of <ISnapshotStrategy>()); enjoyDependenciesBuilder.WithEventSerializer((c) => Mock.Of <IEventSerializer>()); enjoyDependenciesBuilder.WithProjectionSerializer((c) => Mock.Of <IProjectionSerializer>()); enjoyDependenciesBuilder.WithLoggerFactory((c) => Mock.Of <ILoggerFactory>()); enjoyDependenciesBuilder.WithEventsMetadataService((c) => Mock.Of <IEventsMetadataService>()); // Assert var dependencies = enjoyDependenciesBuilder.Build(); dependencies.IsValid().Should().BeTrue(); }