public static EventSourceConfiguration SetDefaultActivator(this EventSourceConfiguration config)
        {
            Precondition.For(() => config).NotNull();
            var activator = new ActivatorDomainObjectActivator();

            config.Activator      = activator;
            config.StateActivator = activator;
            return(config);
        }
Example #2
0
        protected TestDomainObject GetSut(string id)
        {
            var bo        = new TestDomainObject(id);
            var activator = new ActivatorDomainObjectActivator();

            bo.ApplyConfig(new EventSourceConfiguration(), new EventsourceDIContext(activator, activator), new StateEventMapping(), null);

            return(bo);
        }
Example #3
0
        protected static DomainObjectStateRuntime GetSut()
        {
            var domainObject = new TestDomainObject("1");

            domainObject.ApplyEvent(new TestEvent());

            var activator = new ActivatorDomainObjectActivator();

            return(new DomainObjectStateRuntime(
                       domainObject, new EventsourceDIContext(activator, activator), new StateEventMapping(),
                       new EventSourceConfiguration()));
        }
Example #4
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));
        }
        public WhenCreatingADomainObjectByType()
        {
            ActivatorDomainObjectActivator sut = GetSut();

            domainObject = sut.Resolve(typeof(TestDomainObject), id) as TestDomainObject;
        }
Example #6
0
        public WhenCreatingADomainObjectGeneric()
        {
            ActivatorDomainObjectActivator sut = GetSut();

            domainObject = sut.Resolve <TestDomainObject>(id);
        }
        public void ItThroesWhenTypeIsNotADomainObject()
        {
            ActivatorDomainObjectActivator sut = GetSut();

            Assert.Throws <ArgumentException>(() => sut.Resolve(typeof(WhenIvalidActivations), "  "));
        }
        public void ItThroesWhenIdIsEmpty()
        {
            ActivatorDomainObjectActivator sut = GetSut();

            Assert.Throws <ArgumentException>(() => sut.Resolve(typeof(TestDomainObject), "  "));
        }
        public void ItThroesWhenIdIsEmptylGeneric()
        {
            ActivatorDomainObjectActivator sut = GetSut();

            Assert.Throws <ArgumentException>(() => sut.Resolve <TestDomainObject>(" "));
        }
        public void ItThroesWhenTypeIsNull()
        {
            ActivatorDomainObjectActivator sut = GetSut();

            Assert.Throws <ArgumentNullException>(() => sut.Resolve(null, "1213"));
        }