コード例 #1
0
        public void WhenFirstFileExistOnTargetXbox_AndIsTheSameSize_ShouldRemoveFileFromFilesAsRemaining()
        {
            IList <IZipEntry> filesToCheck = new List <IZipEntry>();

            filesToCheck.Add(new ZipEntryFake()
            {
                FileName = "TestFile1", UncompressedSize = 4
            });
            filesToCheck.Add(new ZipEntryFake()
            {
                FileName = "TestFile2", UncompressedSize = 8
            });
            filesToCheck.Add(new ZipEntryFake()
            {
                FileName = "TestFile3", UncompressedSize = 16
            });

            var sut = CreateSut(filesToCheck);

            _xboxGameRepository.Store("TestGame", "TestFile1", new byte[] { 1, 2, 3, 4 });

            // act
            var uploadResumeReport = sut.GetRemainingFiles();

            // assert
            uploadResumeReport.RemainingFiles.Count().Should().Be(2);
            uploadResumeReport.RemainingFiles.Should().NotContain(x => x.FileName == "TestFile1");
            uploadResumeReport.RemainingFiles.Select(x => x.FileName).Should().BeEquivalentTo(new[] { "TestFile2", "TestFile3" });
            uploadResumeReport.SizeUploaded.Should().Be(4);
        }
コード例 #2
0
        public void When50PercentOfFilesExistOnTargetXbox_ShouldReturnOtherFilesAsRemaining()
        {
            IList <IZipEntry> filesToCheck = new List <IZipEntry>();

            filesToCheck.Add(new ZipEntryFake()
            {
                FileName = "TestFile1", UncompressedSize = 4
            });
            filesToCheck.Add(new ZipEntryFake()
            {
                FileName = "TestFile2", UncompressedSize = 4
            });
            filesToCheck.Add(new ZipEntryFake()
            {
                FileName = "TestFile3", UncompressedSize = 4
            });
            filesToCheck.Add(new ZipEntryFake()
            {
                FileName = "TestFile4", UncompressedSize = 4
            });

            var sut = CreateSut(filesToCheck);

            _xboxGameRepository.Store("TestGame", "TestFile1", new byte[] { 1, 2, 3, 4 });
            _xboxGameRepository.Store("TestGame", "TestFile2", new byte[] { 1, 2, 3, 4 });

            // act
            var uploadResumeReport = sut.GetRemainingFiles();

            // assert
            uploadResumeReport.RemainingFiles.Count().Should().Be(2);
            uploadResumeReport.RemainingFiles.Select(x => x.FileName).Should().BeEquivalentTo(new[] { "TestFile3", "TestFile4" });
            uploadResumeReport.SizeUploaded.Should().Be(8);
        }