public void FooItemShouldBeAdded() { //Given var mockEntity = new MockEntityOne(); mockEntity.AddFoos("foo1"); mockEntity.AddFoos("foo2"); //When mockEntity.ApplyEventChanges(); //Then Assert.True(mockEntity.Foos.Contains("foo1") && mockEntity.Foos.Contains("foo2")); }
public void CopiedEntityShouldHaveHigherVersionThanTheOriginalEntity() { var mockEntity = new MockEntityOne(); mockEntity.AddFoos("foo1"); mockEntity.AddFoos("foo2"); mockEntity.SetBar(2); mockEntity.ApplyEventChanges(); var events = new List <EventStream>(mockEntity.AllEvents); var copiedMockEntity = new MockEntityOne(); copiedMockEntity.LoadFromHistory(events); Assert.True(mockEntity.Version < copiedMockEntity.Version); }
public void CopiedEntityAndOriginalEntityShouldHaveTheSameEvents() { var mockEntity = new MockEntityOne(); mockEntity.AddFoos("foo1"); mockEntity.SetBar(2); mockEntity.ApplyEventChanges(); var events = new List <EventStream>(mockEntity.AllEvents); var copiedMockEntity = new MockEntityOne(); copiedMockEntity.LoadFromHistory(events); Assert.True(copiedMockEntity.AllEvents .Any(eventStream => eventStream.GetType() == typeof(FoosAdded)), "FoosAdded event is not in the copiedMockEntity"); }