Exemplo n.º 1
0
        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);
            }
        }
Exemplo n.º 2
0
 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);
     }
 }
Exemplo n.º 3
0
 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);
     }
 }
Exemplo n.º 4
0
        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);
            }
        }