Beispiel #1
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));
        }
Beispiel #2
0
        public void GetFileSizeReturnsCorrectValue()
        {
            // Arrange
            var fs = new MockFileSystem();
            const int size = 352;
            const string file = "c:\\testFile.txt";
            fs.AddFile(file, size);

            // Act
            long value = fs.GetFileLength(file);

            // Assert
            Assert.AreEqual(size, value);
        }