Пример #1
0
        public void CopyFileToExistingFileThrowsIoException()
        {
            // Arrange
            var fs = new MockFileSystem();
            const string oldFilePath = "c:\\old\\file1.txt";
            const long oldSize = 100;
            const string newFilePath = "c:\\new\\file2.txt";
            const long newSize = 300;
            fs.AddFile(oldFilePath, oldSize);
            fs.AddFile(newFilePath, newSize);

            // Act
            fs.CopyFile(oldFilePath, newFilePath);

            // Assert
            Assert.Fail();
        }
Пример #2
0
        public void CopyFileLeavesOldFile()
        {
            // Arrange
            var fs = new MockFileSystem();
            const string oldFilePath = "c:\\old\\file1.txt";
            const long oldSize = 100;
            const string newFilePath = "c:\\new\\file2.txt";
            fs.AddFile(oldFilePath, oldSize);
            fs.CreateDirectory("c:\\new");

            // Act
            fs.CopyFile(oldFilePath, newFilePath);

            // Assert
            Assert.IsTrue(fs.FileExists(oldFilePath));
            Assert.AreEqual(oldSize, fs.GetFileLength(oldFilePath));
        }
Пример #3
0
        public void CopyFile_FromFileIsNullThrowsArgumentNullException()
        {
            // Arrange
            var fs = new MockFileSystem();
            fs.CreateDirectory("c:\\new");
            const string newFilePath = "c:\\new\\file2.txt";
            //long newSize = 300;

            // Act
            fs.CopyFile(null, newFilePath);

            // Assert
            Assert.Fail();
        }
Пример #4
0
        public void CopyFile_ToFileIsNullThrowsArgumentNullException()
        {
            // Arrange
            var fs = new MockFileSystem();
            fs.CreateDirectory("c:\\new");
            const string oldFilePath = "c:\\old\\file1.txt";
            const long oldSize = 100;
            fs.AddFile(oldFilePath, oldSize);

            // Act
            fs.CopyFile(oldFilePath, null);

            // Assert
            Assert.Fail();
        }
Пример #5
0
        public void CopyFile_NonExistantFromFileThrowsFileNotFoundException()
        {
            // Arrange
            var fs = new MockFileSystem();
            const string oldFilePath = "c:\\old\\file1.txt";
            //long oldSize = 100;
            const string newFilePath = "c:\\new\\file2.txt";
            //long newSize = 300;

            // Act
            fs.CopyFile(oldFilePath, newFilePath);

            // Assert
            Assert.Fail();
        }