Example #1
0
        public void bad_entity_throws()
        {
            _streams.Setup(x => x.NewStream <Entity>(Moq.It.IsAny <string>(), new Id("test"),
                                                     Moq.It.IsAny <IEnumerable <Id> >())).Returns(Task.FromResult(_stream.Object));
            _streams.Setup(x => x.GetStream <Entity>(Moq.It.IsAny <string>(), new Id("test"),
                                                     Moq.It.IsAny <IEnumerable <Id> >())).Returns(Task.FromResult(_stream.Object));

            var repository = new Aggregates.Internal.Repository <BadEntity>(_builder.Object);

            Assert.ThrowsAsync <Aggregates.Exceptions.AggregateException>(() => repository.New("test"));
            Assert.ThrowsAsync <Aggregates.Exceptions.AggregateException>(() => repository.Get("test"));
        }
Example #2
0
        public async Task get_exists()
        {
            _eventstore.Setup(x => x.GetEvents <FakeEntity>(Moq.It.IsAny <string>(), Moq.It.IsAny <Id>(), Moq.It.IsAny <Id[]>(), Moq.It.IsAny <long?>(), Moq.It.IsAny <int?>()))
            .Returns(Task.FromResult(new IFullEvent[] { _event.Object }));


            Assert.NotNull(await _repository.Get("test"));
        }
Example #3
0
        public async Task get_exists()
        {
            _streams.Setup(x => x.GetStream <Entity>(Moq.It.IsAny <string>(), new Id("test"),
                                                     Moq.It.IsAny <IEnumerable <Id> >())).Returns(Task.FromResult(_stream.Object));

            Assert.NotNull(await _repository.Get("test"));
        }