コード例 #1
0
        public async Task Returns_empty_IEnumerable_of_Person_when_not_found()
        {
            using (var db = InMemoryDatabaseContext
                            .CreateDatabaseContext(
                       nameof(Returns_empty_IEnumerable_of_Person_when_not_found)
                       )
                   )
            {
                var sut    = new GetPeopleByName.Handler(db);
                var result = await sut.HandleAsync(
                    new GetPeopleByName.Query("schelpe"),
                    CancellationToken.None
                    );

                result.Should().NotBeNull();
                result.Should().BeEmpty();
            }
        }
コード例 #2
0
        public async Task Returns_IEnumerable_of_Person_when_match_is_found_case_is_ignored(
            string partOfName
            )
        {
            using (var db = InMemoryDatabaseContext
                            .CreateDatabaseContext(
                       $"{nameof(Returns_IEnumerable_of_Person_when_match_is_found_case_is_ignored)}_{partOfName}",
                       new List <Person> {
                Person.Create(33311, Name.Create("Yves", "Schelpe"))
            }
                       )
                   )
            {
                var sut    = new GetPeopleByName.Handler(db);
                var result = await sut.HandleAsync(
                    new GetPeopleByName.Query(partOfName),
                    CancellationToken.None
                    );

                result.Should().NotBeEmpty();
                result.ElementAt(0).Name.FirstName.Should().Be("Yves");
            }
        }