Пример #1
0
        public async Task WriteCustomData()
        {
            var en = new CustomSolutionItemNode <TestSolutionExtension> ();

            WorkspaceObject.RegisterCustomExtension(en);
            try {
                string solFile = Util.GetSampleProject("solution-custom-data", "custom-data.sln");

                var sol = new Solution();
                var ext = sol.GetService <TestSolutionExtension> ();
                Assert.NotNull(ext);
                ext.Prop1 = "one";
                ext.Prop2 = "two";
                ext.Extra = new ComplexSolutionData {
                    Prop3 = "three",
                    Prop4 = "four"
                };
                var savedFile = solFile + ".saved.sln";
                await sol.SaveAsync(savedFile, Util.GetMonitor());

                Assert.AreEqual(File.ReadAllText(solFile), File.ReadAllText(savedFile));
                sol.Dispose();
            } finally {
                WorkspaceObject.UnregisterCustomExtension(en);
            }
        }