Example #1
0
            public void ThrowsIOExceptionWhenFileWithThatNameAlreadyExists()
            {
                string fileName = GetUniqueFileName();

                FileSystemTest.CreatePlatformFile(fileName, this.storageFolder);

                var folder = new PlatformFolder(this.storageFolder);

                AssertEx.Throws <IOException>(() => folder.CreateFile(fileName));
            }
            public void ThrowsIOExceptionWhenFileWithDesiredNameAlreadyExists()
            {
                var file = new PlatformFile(this.platformFile);

                string newName         = GetUniqueFileName();
                var    conflictingFile = FileSystemTest.CreatePlatformFile(newName);

                AssertEx.Throws <IOException>(() => file.Rename(newName));

                FileSystemTest.DeletePlatformItem(conflictingFile);
            }
Example #3
0
            public void ReturnsEnumerableOfObjectsRepresentingExistingFiles()
            {
                string[] expectedFileNames = new string[] { "file.1", "blah.txt", "foo.bar" };
                foreach (string fileName in expectedFileNames)
                {
                    FileSystemTest.CreatePlatformFile(fileName, this.storageFolder);
                }

                var folder = new PlatformFolder(this.storageFolder);

                IEnumerable <IPlatformFile> files = folder.GetFiles();

                AssertEx.AreEqual(expectedFileNames.OrderBy(name => name), files.Select(f => f.Name).OrderBy(name => name));
            }
        public PlatformFileTest()
        {
            string uniqueFileName = GetUniqueFileName();

            this.platformFile = FileSystemTest.CreatePlatformFile(uniqueFileName);
        }