示例#1
0
 protected override Task SaveAsync(TextAndVersion textAndVersion, CancellationToken cancellationToken)
 {
     _storage        = _storageService.CreateTemporaryTextStorage(CancellationToken.None);
     _storedVersion  = textAndVersion.Version;
     _storedFilePath = textAndVersion.FilePath;
     return(_storage.WriteTextAsync(textAndVersion.Text));
 }
示例#2
0
        private void TestTemporaryStorage(ITemporaryStorageService temporaryStorageService, SourceText text)
        {
            // create a temporary storage location
            var temporaryStorage = temporaryStorageService.CreateTemporaryTextStorage(System.Threading.CancellationToken.None);

            // write text into it
            temporaryStorage.WriteTextAsync(text).Wait();

            // read text back from it
            var text2 = temporaryStorage.ReadTextAsync().Result;

            Assert.NotSame(text, text2);
            Assert.Equal(text.ToString(), text2.ToString());

            temporaryStorage.Dispose();
        }
        private void TestTemporaryStorage(ITemporaryStorageService temporaryStorageService, SourceText text)
        {
            // create a temporary storage location
            var temporaryStorage = temporaryStorageService.CreateTemporaryTextStorage(System.Threading.CancellationToken.None);

            // write text into it
            temporaryStorage.WriteTextAsync(text).Wait();

            // read text back from it
            var text2 = temporaryStorage.ReadTextAsync().Result;

            Assert.NotSame(text, text2);
            Assert.Equal(text.ToString(), text2.ToString());

            temporaryStorage.Dispose();
        }