Пример #1
0
 protected DomainObjectRepositoryBase GetSut(IDomainObjectActivator activator)
 {
     return(new FakeRepository(new EventSourceConfiguration()
     {
         Activator = activator
     }));
 }
Пример #2
0
        public EventsourceDIContext(IDomainObjectActivator domainObjectActivator, IStateActivator stateActivator)
        {
            Precondition.For(domainObjectActivator, nameof(domainObjectActivator)).NotNull();
            Precondition.For(stateActivator, nameof(stateActivator)).NotNull();

            DomainObjectActivator = domainObjectActivator;
            StateActivator        = stateActivator;
        }
Пример #3
0
        public static EventStoreContext CreateDefault(string prefix, IEventStoreConnection connection,
                                                      IDomainObjectActivator activator = null)
        {
            var namer           = new StreamTypeNamer(prefix);
            var eventSerializer = new JsonEventSerializer(new EventTypeResolver());
            var transformer     = new EventTransformator(eventSerializer);

            if (activator == null)
            {
                activator = new ActivatorDomainObjectActivator();
            }

            return(new EventStoreContext(connection, namer, new EventStoreReader(connection, transformer),
                                         new EventStoreWriter(connection, transformer), activator));
        }
Пример #4
0
        private EventStoreContext(IEventStoreConnection connection, IStreamNamer streamNamer, IEventReader reader,
                                  IEventWriter writer, IDomainObjectActivator activator)
        {
            Precondition.For(connection, nameof(connection)).NotNull();
            Precondition.For(streamNamer, nameof(streamNamer)).NotNull();
            Precondition.For(reader, nameof(reader)).NotNull();
            Precondition.For(writer, nameof(writer)).NotNull();
            Precondition.For(activator, nameof(activator)).NotNull();

            Connection  = connection;
            Reader      = reader;
            Writer      = writer;
            Activator   = activator;
            StreamNamer = streamNamer;
        }
        protected ResolvingDomainObjectTests()
        {
            IDomainObjectActivator sut = GetSut();

            domainObject = sut.Resolve <CustomerDomainObject>(customerId);
        }
Пример #6
0
 private void CreateFakeActivator()
 {
     activator = A.Fake <IDomainObjectActivator>();
     A.CallTo(() => activator.Resolve(A <Type> .That.IsEqualTo(domainObjectType), A <string> .That.IsEqualTo(id))).Returns(expectedResult);
 }
Пример #7
0
        protected DomainObjectRepositoryBase GetSut(IDomainObjectActivator activator, IStateActivator stateActivator)
        {
            var repo = new FakeRepository(new EventSourceConfiguration(), new EventsourceDIContext(activator, stateActivator));

            return(repo);
        }