public void Establish()
        {
            _mockedPackageRepository = new Mock<IRepository<Package>>();
            _mockedAggregateUpdater = new Mock<IPackageDataAggregateUpdater>();

            _packagesFromRepository = new[]
            {
                new Package {Id = "pack1", Version = "1.0", RatingAverage = 3.2, RatingsCount = 8},
                new Package {Id = "pack3", Version = "3.1", RatingAverage = 4.5, RatingsCount = 15},
                new Package {Id = "pack2", Version = "2.0", RatingAverage = 3.0, RatingsCount = 45},
                new Package {Id = "pack1", Version = "1.1", RatingAverage = 3.4, RatingsCount = 12},
                new Package {Id = "pack4", Version = "4.2.1", RatingAverage = 4.0, RatingsCount = 27},
            }.AsQueryable();
            _mockedPackageRepository.SetupGet(r => r.Collection).Returns(_packagesFromRepository);

            _packageRatingUpdater = new Core.Impl.PackageRatingUpdater(_mockedPackageRepository.Object, _mockedAggregateUpdater.Object);
            _packageVersionRatings = new[]
            {
                new PackageVersionRatings { PackageId = "pack1", PackageVersion = "1.0", RatingAverage = 3.5, RatingCount =  10},
                new PackageVersionRatings { PackageId = "pack2", PackageVersion = "2.0", RatingAverage = 2.8, RatingCount =  50}
            };
            _packageRatingUpdater.UpdatePackageRatings(_packageVersionRatings);
        }
Beispiel #2
0
        public void Establish()
        {
            _mockedPackageRepository = new Mock <IRepository <Package> >();
            _mockedAggregateUpdater  = new Mock <IPackageDataAggregateUpdater>();

            _packagesFromRepository = new[]
            {
                new Package {
                    Id = "pack1", Version = "1.0", RatingAverage = 3.2, RatingsCount = 8
                },
                new Package {
                    Id = "pack3", Version = "3.1", RatingAverage = 4.5, RatingsCount = 15
                },
                new Package {
                    Id = "pack2", Version = "2.0", RatingAverage = 3.0, RatingsCount = 45
                },
                new Package {
                    Id = "pack1", Version = "1.1", RatingAverage = 3.4, RatingsCount = 12
                },
                new Package {
                    Id = "pack4", Version = "4.2.1", RatingAverage = 4.0, RatingsCount = 27
                },
            }.AsQueryable();
            _mockedPackageRepository.SetupGet(r => r.Collection).Returns(_packagesFromRepository);

            _packageRatingUpdater  = new Core.Impl.PackageRatingUpdater(_mockedPackageRepository.Object, _mockedAggregateUpdater.Object);
            _packageVersionRatings = new[]
            {
                new PackageVersionRatings {
                    PackageId = "pack1", PackageVersion = "1.0", RatingAverage = 3.5, RatingCount = 10
                },
                new PackageVersionRatings {
                    PackageId = "pack2", PackageVersion = "2.0", RatingAverage = 2.8, RatingCount = 50
                }
            };
            _packageRatingUpdater.UpdatePackageRatings(_packageVersionRatings);
        }
Beispiel #3
0
        public void NotThrowAnException()
        {
            TestDelegate methodThatShouldNotThrow = () => _packageRatingUpdater.UpdatePackageRatings(_emptyList);

            Assert.DoesNotThrow(methodThatShouldNotThrow);
        }