Example #1
0
        public void GroupDifferentLinks()
        {
            var downloadRequest = new DownloadRequest()
            {
                Threads = 2,
                Links   = new System.Collections.Generic.List <LinkSave>
                {
                    new LinkSave {
                        Filename = "file1", Link = "http://file1"
                    },
                    new LinkSave {
                        Filename = "file2", Link = "http://file2"
                    },
                    new LinkSave {
                        Filename = "file3", Link = "http://file3"
                    },
                }
            };
            var downloadService = new DownloaderService(new FileDonwladStatus()
                                                        , NSubstitute.Substitute.For <Microsoft.Extensions.Configuration.IConfiguration>()
                                                        , NSubstitute.Substitute.For <Microsoft.Extensions.Logging.ILogger <DownloaderService> >());
            var grouped = downloadService.GetGroupedLinks(downloadRequest);

            Assert.Equal(3, grouped.Count);
        }
Example #2
0
        public void GroupEmptyLinks()
        {
            var downloadRequest = new DownloadRequest()
            {
                Threads = 2,
                Links   = null
            };
            var downloadService = new DownloaderService(new FileDonwladStatus()
                                                        , NSubstitute.Substitute.For <Microsoft.Extensions.Configuration.IConfiguration>()
                                                        , NSubstitute.Substitute.For <Microsoft.Extensions.Logging.ILogger <DownloaderService> >());
            var grouped = downloadService.GetGroupedLinks(downloadRequest);

            Assert.Empty(grouped);
        }