コード例 #1
0
        public void CanWriteReadDelteFile()
        {
            var tempDir  = Path.GetTempPath();
            var tempFile = Path.GetRandomFileName();

            var fullName = Path.Combine(tempDir, tempFile);

            FileProvider.CreateFileAsync(fullName, "Jake").GetAwaiter().GetResult();
            var file = FileProvider.GetFileInfoAsync(fullName).Result;

            Assert.IsTrue(file.Exists);
            Assert.AreEqual(fullName, file.Path);
            Assert.AreEqual("Jake", file.ReadAllTextAsync().GetAwaiter().GetResult());

            FileProvider.DeleteFileAsync(fullName).GetAwaiter().GetResult();

            file = FileProvider.GetFileInfoAsync(fullName).Result;

            Assert.IsFalse(file.Exists);
        }