public static EventSourceConfiguration SetDefaultActivator(this EventSourceConfiguration config) { Precondition.For(() => config).NotNull(); var activator = new ActivatorDomainObjectActivator(); config.Activator = activator; config.StateActivator = activator; return(config); }
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); }
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())); }
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; }
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")); }