示例#1
0
        public void InvalidJson()
        {
            var settingsStorage = new SettingsStorage(this.path.Path);
            var fullPath        = settingsStorage.Save(null, null, this.settings);

            Assert.IsNotNull(settingsStorage.TryLoad(null, null));

            File.AppendAllText(fullPath, "InvalidJson");
            TestHelper.AssertThrows <VSPackageException>(() => {
                settingsStorage.TryLoad(null, null);
                Assert.Fail();
            });
        }
示例#2
0
        public void SaveLoadNoProject()
        {
            var settingsStorage = new SettingsStorage(this.path.Path);
            var fullPath        = settingsStorage.Save(null, null, this.settings);

            var expectedPath = Path.Combine(
                this.path.Path, SettingsStorage.ApplicationDataSection,
                SettingsStorage.NoProjectConfigName + ".json");

            Assert.AreEqual(expectedPath, fullPath);

            var loadedSettings = settingsStorage.TryLoad(null, null);

            AssertEqual(this.settings, loadedSettings);
        }
示例#3
0
        public void SaveLoad()
        {
            var          settingsStorage   = new SettingsStorage(null);
            const string projectName       = "Project.csproj";
            const string configurationName = "Configuration";
            var          projectPath       = Path.Combine(this.path.Path, projectName);
            var          fullPath          = settingsStorage.Save(projectPath, configurationName, this.settings);

            var expectedPath = Path.Combine(
                this.path.Path, SettingsStorage.OpenCppCov,
                Path.GetFileNameWithoutExtension(projectName), configurationName + ".json");

            Assert.AreEqual(expectedPath, fullPath);

            var loadedSettings = settingsStorage.TryLoad(projectPath, configurationName);

            AssertEqual(this.settings, loadedSettings);
        }
示例#4
0
        public void TryLoadNotFound()
        {
            var settingsStorage = new SettingsStorage(null);

            Assert.IsNull(settingsStorage.TryLoad("FolderNotFound", null));
        }