public async Task FindIdByUniqueIndexedProperty_relays_to_event_store() { // Arrange var name = fixture.Create <string>(); var value = fixture.Create <string>(); var expected = fixture.Create <Guid?>(); var eventStore = Mock.Of <ISqlEventStore>(); Mock.Get(eventStore) .Setup( x => x.FindIdByUniqueIndexedProperty <FakeUser>( name, value, CancellationToken.None)) .ReturnsAsync(expected); var sut = new SqlEventSourcedRepository <FakeUser>( eventStore, Mock.Of <ISqlEventPublisher>(), Mock.Of <Func <Guid, IEnumerable <IDomainEvent>, FakeUser> >()); // Act Guid?actual = await sut.FindIdByUniqueIndexedProperty(name, value, CancellationToken.None); // Assert actual.Should().Be(expected); }
public async Task FindIdByUniqueIndexedProperty_relays_to_event_store() { // Arrange string name = Guid.NewGuid().ToString(); string value = Guid.NewGuid().ToString(); Guid? expected = Guid.NewGuid(); ISqlEventStore eventStore = Mock.Of <ISqlEventStore>(); Mock.Get(eventStore) .Setup(x => x.FindIdByUniqueIndexedProperty <FakeUser>(name, value, default)) .ReturnsAsync(expected); var sut = new SqlEventSourcedRepository <FakeUser>( eventStore, Mock.Of <ISqlEventPublisher>(), FakeUser.Factory); // Act Guid?actual = await sut.FindIdByUniqueIndexedProperty(name, value, default); // Assert actual.Should().Be(expected); }