Beispiel #1
0
        public async Task FindIdByUniqueIndexedProperty_returns_null_if_property_not_found()
        {
            string value  = fixture.Create("username");
            Guid?  actual = await
                            sut.FindIdByUniqueIndexedProperty <FakeUser>("Username", value);

            actual.Should().NotHaveValue();
        }
        public async Task FindIdByUniqueIndexedProperty_returns_null_if_property_not_found()
        {
            string value = Guid.NewGuid().ToString();
            var    sut   = new SqlEventStore(
                () => new FakeEventStoreDbContext(_dbContextOptions),
                new JsonMessageSerializer());

            Guid?actual = await sut.FindIdByUniqueIndexedProperty <FakeUser>("Username", value);

            actual.Should().NotHaveValue();
        }
        public async Task FindIdByUniqueIndexedProperty_returns_aggregate_id_if_property_found()
        {
            var userId  = Guid.NewGuid();
            var created = new FakeUserCreated();

            created.Raise(userId);
            var sut = new SqlEventStore(
                () => new FakeEventStoreDbContext(_dbContextOptions),
                new JsonMessageSerializer());
            await sut.SaveEvents <FakeUser>(new[] { created });

            Guid?actual = await sut.FindIdByUniqueIndexedProperty <FakeUser>("Username", created.Username);

            actual.Should().Be(userId);
        }