コード例 #1
0
        public void Should_not_be_able_to_add_a_view_with_existing_key()
        {
            var readerWriter = new InMemoryProjectionReaderWriter<Guid, DummyView>(new ConcurrentDictionary<Guid, DummyView>());
            var key = Guid.NewGuid();

            var view1 = new DummyView() {
                Id = key,
                Anything = Guid.NewGuid().ToString()
            };

            var view2 = new DummyView() {
                Id = key,
                Anything = Guid.NewGuid().ToString()
            };

            readerWriter.Add(key, view1);
            readerWriter.Add(key, view2);
        }
コード例 #2
0
        public void Should_be_able_to_add_a_view()
        {
            var readerWriter = new InMemoryProjectionReaderWriter<Guid, DummyView>(new ConcurrentDictionary<Guid, DummyView>());
            var view = new DummyView() {
                Id = Guid.NewGuid(),
            };

            var addedView = readerWriter.Add(view.Id, view);
            Assert.AreEqual(view, addedView);
        }