Exemplo n.º 1
0
        public async Task AddRangeAsync_WithDuplicate_DuplicatesAreNotAdded()
        {
            var          uploadList    = new UploadList(_helpers);
            const string duplicatePath = "a";
            var          duplicate     = new UploadFile()
            {
                FullPath = duplicatePath
            };
            var addFiles1 = new List <UploadFile>
            {
                new UploadFile()
                {
                    FullPath = duplicatePath
                },
                new UploadFile()
                {
                    FullPath = "b"
                },
            };
            var addFiles2 = new List <UploadFile>
            {
                duplicate,
                new UploadFile()
                {
                    FullPath = "c"
                },
            };

            uploadList.AddRange(addFiles1);
            await uploadList.AddRangeAsync(addFiles2);

            Assert.That(uploadList.Count, Is.EqualTo(3));
            Assert.That(uploadList, Does.Not.Contain(duplicate));
        }
Exemplo n.º 2
0
        public async Task AddRangeAsync_FilesAreAdded()
        {
            var uploadList = new UploadList(_helpers);
            var addFiles   = new List <UploadFile>();

            for (var k = 0; k < 500; k++)
            {
                addFiles.Add(new UploadFile(k.ToString()));
            }

            await uploadList.AddRangeAsync(addFiles);

            Assert.That(uploadList.ToList(), Is.EqualTo(addFiles));
        }