Ejemplo n.º 1
0
        public async Task Find_returns_null_if_event_not_found(Guid userId)
        {
            Mock.Get(eventStore)
            .Setup(
                x =>
                x.LoadEvents <FakeUser>(userId, 0, CancellationToken.None))
            .ReturnsAsync(Enumerable.Empty <IDomainEvent>());

            FakeUser actual = await sut.Find(userId, CancellationToken.None);

            actual.Should().BeNull();
        }
        public async Task Find_returns_null_if_no_event()
        {
            var userId = Guid.NewGuid();

            Mock.Get(eventStore)
            .Setup(
                x =>
                x.LoadEvents <FakeUser>(userId, 0, CancellationToken.None))
            .ReturnsAsync(new IDomainEvent[0]);

            FakeUser actual = await sut.Find(userId, CancellationToken.None);

            actual.Should().BeNull();
        }
        public async Task Find_returns_null_if_no_event()
        {
            // Arrange
            var userId = Guid.NewGuid();

            ISqlEventStore eventStore = Mock.Of <ISqlEventStore>();

            Mock.Get(eventStore)
            .Setup(x => x.LoadEvents <FakeUser>(userId, 0, default))
            .ReturnsAsync(new IDomainEvent[0]);

            var sut = new SqlEventSourcedRepository <FakeUser>(
                eventStore,
                Mock.Of <ISqlEventPublisher>(),
                FakeUser.Factory);

            // Act
            FakeUser actual = await sut.Find(userId, default);

            // Assert
            actual.Should().BeNull();
        }