public void Store_once() { using (var sut = new InMemoryEventRepository("")) { sut.Store(0, new TestEvent()); Assert.Throws <InvalidOperationException>(() => sut.Store(0, new TestEvent())); Assert.Equal(1, sut.Count); } }
public void Counting_events() { using (var sut = new InMemoryEventRepository("")) { sut.Store(0, new TestEvent()); Assert.Equal(1, sut.Count); sut.Store(1, new TestEvent()); Assert.Equal(2, sut.Count); } }
public void Index_must_be_geq_0() { using (var sut = new InMemoryEventRepository("")) { Assert.Throws <InvalidOperationException>(() => sut.Store(-1, new TestEvent())); Assert.Equal(0, sut.Count); } }
public void Store_and_load() { using (var sut = new InMemoryEventRepository("")) { var e = new TestEvent { Foo = "Hello" }; sut.Store(0, e); var result = (TestEvent)sut.Load(0); Assert.Equal(e, result); Assert.Equal(e.Id, result.Id); Assert.Equal(e.Foo, result.Foo); } }