예제 #1
0
        public async void FindAsync_GivenCategoriesExist_ReturnsEnumerableCategories()
        {
            var categoriesToReturn = new CategoryDTO[]
            {
                new CategoryDTO {
                    Id = 1, Name = "This is the first"
                },
                new CategoryDTO {
                    Id = 2, Name = "This is the second"
                },
                new CategoryDTO {
                    Id = 3, Name = "This is the third"
                }
            };

            categoryRepositoryMock.Setup(c => c.FindWildcardAsync("this")).ReturnsAsync(categoriesToReturn);

            using (var logic = new CategoryLogic(categoryRepositoryMock.Object, projectRepositoryMock.Object))
            {
                var results = await logic.FindAsync("this");

                Assert.Equal(categoriesToReturn, results);
                categoryRepositoryMock.Verify(c => c.FindWildcardAsync("this"));
            }
        }