コード例 #1
0
        public void CanSearchAuthors()
        {
            // Arrange
            var author = A<string>();
            var mock = Mock<IGalleryFeedContext>();
            mock
                .Setup(x => x.AllPackages)
                .Returns(new[]
                    {
                        new V1FeedPackage { Authors = author }, // Author equals
                        new V1FeedPackage { Authors = A<string>() + "," + author + "," + A<string>() }, // Author contained
                        new V1FeedPackage { Authors = author + "," + A<string>() }, // Author first
                        new V1FeedPackage { Authors = A<string>() + "," + author }, // Author last
                        new V1FeedPackage { Authors = A<string>() }, // Author not contained
                    }.AsQueryable());

            var nuGetOrgFeed = new NuGetOrgFeed(mock.Object);

            // Act
            var result = nuGetOrgFeed.SearchAuthors(author);

            // Assert
            Assert.That(result != null);
            Assert.That(result.Count(), Is.EqualTo(1));
            Assert.That(result.First(), Is.EqualTo(author));
        }
コード例 #2
0
ファイル: FeedController.cs プロジェクト: segilbert/NuGetFeed
 public FeedController(UserRepository userRepository, FeedRepository feedRepository, ListController listController, UploadPackagesRequestRepository uploadPackagesRequestRepository, NuGetOrgFeed nuGetOrgFeed, SyndicationHelper syndicationHelper)
 {
     _userRepository = userRepository;
     _feedRepository = feedRepository;
     _listController = listController;
     _uploadPackagesRequestRepository = uploadPackagesRequestRepository;
     _nuGetOrgFeed = nuGetOrgFeed;
     _syndicationHelper = syndicationHelper;
 }
コード例 #3
0
 public PackagesController(NuGetOrgFeed nuGetOrgFeed)
 {
     _nuGetOrgFeed = nuGetOrgFeed;
 }
コード例 #4
0
 public ListController(NuGetOrgFeed nuGetOrgFeed)
 {
     _nuGetOrgFeed = nuGetOrgFeed;
 }
コード例 #5
0
ファイル: HomeController.cs プロジェクト: segilbert/NuGetFeed
 public HomeController(FeedRepository feedRepository, NuGetOrgFeed nuGetOrgFeed)
 {
     _feedRepository = feedRepository;
     _nuGetOrgFeed = nuGetOrgFeed;
 }
コード例 #6
0
 public CategoryController(CategoryRepository categoryRepository, NuGetOrgFeed nuGetOrgFeed)
 {
     _categoryRepository = categoryRepository;
     _nuGetOrgFeed = nuGetOrgFeed;
 }