Exemplo n.º 1
0
            public void ReturnsCorrectNumberOfPackageRegistrationGroups(int batchSize, int expectedGroupCount)
            {
                // Arrange
                var data = new Stack <IPackageIdGroup>(new[]
                {
                    new DownloadCountData {
                        PackageId = "A", PackageVersion = "4.2.0"
                    },
                    new DownloadCountData {
                        PackageId = "A", PackageVersion = "4.3.0"
                    },
                    new DownloadCountData {
                        PackageId = "A", PackageVersion = "4.4.0"
                    },
                    new DownloadCountData {
                        PackageId = "A", PackageVersion = "4.5.0"
                    },
                    new DownloadCountData {
                        PackageId = "A", PackageVersion = "4.6.0"
                    },                                                                   // 5 versions, 1 ID (6 total records so far)

                    new DownloadCountData {
                        PackageId = "B", PackageVersion = "4.5.0"
                    },
                    new DownloadCountData {
                        PackageId = "B", PackageVersion = "4.6.0"
                    },                                                                   // 2 versions, 1 ID (9 total records so far)

                    new DownloadCountData {
                        PackageId = "C", PackageVersion = "4.6.0"
                    },                                                                   // 1 version, 1 ID (11 total records)

                    new DownloadCountData {
                        PackageId = "D", PackageVersion = "4.4.0"
                    },
                    new DownloadCountData {
                        PackageId = "D", PackageVersion = "4.5.0"
                    },
                    new DownloadCountData {
                        PackageId = "D", PackageVersion = "4.6.0"
                    },                                                                   // 3 versions, 1 ID (15 total records)
                }.GroupBy(x => x.PackageId).OrderByDescending(x => x.Key));

                // Act
                var groupBatch = AggregateCdnDownloadsJob.PopGroupBatch(data, batchSize);

                // Assert
                Assert.Equal(expectedGroupCount, groupBatch.Count);
            }
Exemplo n.º 2
0
        public static void Main(string[] args)
        {
            var job = new AggregateCdnDownloadsJob();

            JobRunner.Run(job, args).Wait();
        }