コード例 #1
0
        public async System.Threading.Tasks.Task SaveFilesToIgnore_EmptyState_ConfigAsync()
        {
            await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync();

            await UnitTestUtility.LoadPackageAsync();

            Initialize(string.Empty);
            await IgnoreFilesAsync(IgnoreCommand.kSingleFileToIgnore);

            SettingsHandler.SaveFormatSettings();

            if (!File.Exists(kFormatSettingsPath))
            {
                Assert.False(true);
            }

            XmlSerializer serializer          = new XmlSerializer();
            var           formatSettingsModel = serializer.DeserializeFromFile <ClangFormatOptions>(kFormatSettingsPath);

            var filesToIgnore  = formatSettingsModel.SkipFiles;
            var expectedRestul = string.Join(";", IgnoreCommand.kSingleFileToIgnore);

            SettingsTestUtility.ResetClangFormatOptionsView();

            Assert.Equal(filesToIgnore, expectedRestul);
        }
コード例 #2
0
        public async System.Threading.Tasks.Task SaveFilesToIgnore_NoEmptyState_ConfigAsync()
        {
            await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync();

            await UnitTestUtility.LoadPackageAsync();

            var expectedResult = string.Join(";", IgnoreCommand.kStartUpMultipleFilesToIgnore);

            Initialize(string.Empty);

            await IgnoreFilesAsync(IgnoreCommand.kStartUpMultipleFilesToIgnore);
            await IgnoreFilesAsync(IgnoreCommand.kMultipleFilesToIgnore);

            SettingsHandler.SaveGeneralSettings();

            if (!File.Exists(kGeneralSettingsPath))
            {
                Assert.False(true);
            }

            XmlSerializer serializer = new XmlSerializer();

            var generalSettingsModel = serializer.DeserializeFromFile <ClangOptions>(kGeneralSettingsPath);

            expectedResult += ";" + string.Join(";", IgnoreCommand.kMultipleFilesToIgnore);

            var filesToIgnore = generalSettingsModel.FilesToIgnoreCollection;

            SettingsTestUtility.ResetClangGeneralOptionsView();

            Assert.Equal(filesToIgnore, expectedResult);
        }
コード例 #3
0
        private void Initialize(string ignoreFiles)
        {
            ThreadHelper.ThrowIfNotOnUIThread();
            mDte = (DTE2)ServiceProvider.GlobalProvider.GetService(typeof(DTE));
            SettingsTestUtility.ResetClangFormatOptionsView();

            mIgnoreFormatCommand         = IgnoreFormatCommand.Instance;
            mFormatOptions               = SettingsProvider.ClangFormatSettings;
            mFormatOptions.FilesToIgnore = ignoreFiles;
        }
コード例 #4
0
        public async System.Threading.Tasks.Task SaveMultipleFilesToIgnore_EmptyState_UIAsync()
        {
            await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync();

            await UnitTestUtility.LoadPackageAsync();

            Initialize(string.Empty);
            await IgnoreFilesAsync(IgnoreCommand.kMultipleFilesToIgnore);

            SettingsHandler.SaveFormatSettings();

            var filesToIgnore  = mFormatOptions.FilesToIgnore;
            var expectedRestul = string.Join(";", IgnoreCommand.kMultipleFilesToIgnore);

            SettingsTestUtility.ResetClangFormatOptionsView();

            Assert.Equal(filesToIgnore, expectedRestul);
        }
コード例 #5
0
        public async System.Threading.Tasks.Task SaveFilesToIgnore_NoEmptyState_UIAsync()
        {
            await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync();

            await UnitTestUtility.LoadPackageAsync();

            var expectedResult = string.Join(";", IgnoreCommand.kStartUpMultipleFilesToIgnore);

            Initialize(expectedResult);
            await IgnoreFilesAsync(IgnoreCommand.kMultipleFilesToIgnore);

            SettingsHandler.SaveGeneralSettings();

            expectedResult += ";" + string.Join(";", IgnoreCommand.kMultipleFilesToIgnore);
            var filesToIgnore = mGeneralOptions.FilesToIgnore;

            SettingsTestUtility.ResetClangGeneralOptionsView();

            Assert.Equal(filesToIgnore, expectedResult);
        }