Пример #1
0
        public void oob_no_define_throws()
        {
            var stream = new Aggregates.Internal.EventStream <Entity>("test", "test", null, null, _events, null);

            Assert.Throws <InvalidOperationException>(
                () => stream.AddOob(new FakeEvent(), "test", new Dictionary <string, string>()));
        }
Пример #2
0
        public void oob_uncomitted()
        {
            var stream = new Aggregates.Internal.EventStream <Entity>("test", "test", null, null, _events, null);

            stream.DefineOob("test");
            stream.AddOob(new FakeEvent(), "test", new Dictionary <string, string>());

            Assert.AreEqual(1, stream.Uncommitted.Count());
        }
Пример #3
0
        public void oob_dirty_check()
        {
            var stream = new Aggregates.Internal.EventStream <Entity>("test", "test", null, null, _events, null);

            Assert.False(stream.Dirty);

            stream.DefineOob("test");
            stream.AddOob(new FakeEvent(), "test", new Dictionary <string, string>());

            Assert.True(stream.Dirty);
        }
Пример #4
0
        public void total_uncomitted()
        {
            var stream = new Aggregates.Internal.EventStream <Entity>("test", "test", null, null, _events, null);

            Assert.AreEqual(0, stream.TotalUncommitted);

            stream.Add(new FakeEvent(), new Dictionary <string, string>());

            Assert.AreEqual(1, stream.TotalUncommitted);

            stream.DefineOob("test");
            stream.AddOob(new FakeEvent(), "test", new Dictionary <string, string>());

            Assert.AreEqual(2, stream.TotalUncommitted);

            var memento = new Moq.Mock <IMemento>();

            stream.AddSnapshot(memento.Object);

            Assert.AreEqual(3, stream.TotalUncommitted);
        }