コード例 #1
0
        public async Task UpgradeInstance()
        {
            FilePath filePath = "test.txt";
            var      file     = new FileModel();

            file.CreateNew();
            await file.SetContent(TestHelper.ToStream("Foo"));

            await file.LinkToFile(filePath);

            await registry.ShareModel(file);

            var textFile = await registry.GetSharedModel <TextFileModel> (filePath);

            Assert.IsFalse(textFile.IsLoaded);
            await textFile.Load();

            Assert.AreEqual("Foo", textFile.GetText());

            var textBufferFile = await registry.GetSharedModel <TextBufferFileModel> (filePath);

            Assert.IsFalse(textBufferFile.IsLoaded);
            await textBufferFile.Load();

            Assert.AreEqual("Foo", textBufferFile.GetText());
        }