public void HandlePastEvents_has_guard_clause_against_invalid_Version() { var sut = new EventSourcedProxy(Guid.NewGuid()); sut.SetEventHandler <SomeDomainEvent>(e => { }); IDomainEvent[] pastEvents = new IDomainEvent[] { new SomeDomainEvent { SourceId = sut.Id, Version = 1, RaisedAt = DateTime.UtcNow, Property = Guid.NewGuid(), }, new SomeDomainEvent { SourceId = sut.Id, Version = 1, RaisedAt = DateTime.UtcNow, Property = Guid.NewGuid(), }, }; Action action = () => sut.HandlePastEvents(pastEvents); action.ShouldThrow <ArgumentException>(); }
public void HandlePastEvents_fails_for_unknown_domain_event_type() { var sut = new EventSourcedProxy(Guid.NewGuid()); IDomainEvent[] pastEvents = new IDomainEvent[] { new SomeDomainEvent { SourceId = sut.Id, Version = 1, RaisedAt = DateTime.UtcNow, Property = Guid.NewGuid(), }, }; Action action = () => sut.HandlePastEvents(pastEvents); action.ShouldThrow <InvalidOperationException>(); }