public void SetEventHandler_has_guard_clause_against_duplicate_event_type() { var sut = new EventSourcedProxy(Guid.NewGuid()); sut.SetEventHandler <SomeDomainEvent>(e => { }); Action action = () => sut.SetEventHandler <SomeDomainEvent>(e => { }); action.ShouldThrow <InvalidOperationException>(); }
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>(); }