-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Clear User Settings Functionality (RDMP-7/GH#749) (#1586)
* Add Clear User Settings button, command and unit test * Update SelfCertifyingDataAccessPoint.cs - Fix typo --------- Co-authored-by: jas88 <[email protected]>
- Loading branch information
Showing
8 changed files
with
135 additions
and
2 deletions.
There are no files selected for viewing
34 changes: 34 additions & 0 deletions
34
Rdmp.Core.Tests/CommandExecution/TestExecuteCommandClearUserSettings.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// Copyright (c) The University of Dundee 2018-2023 | ||
// This file is part of the Research Data Management Platform (RDMP). | ||
// RDMP is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. | ||
// RDMP is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. | ||
// You should have received a copy of the GNU General Public License along with RDMP. If not, see <https://www.gnu.org/licenses/>. | ||
|
||
using NUnit.Framework; | ||
using Rdmp.Core.CommandExecution.AtomicCommands; | ||
using Rdmp.Core.CommandLine.Interactive.Picking; | ||
using Rdmp.Core.ReusableLibraryCode.Checks; | ||
using Rdmp.Core.ReusableLibraryCode.Settings; | ||
|
||
namespace Rdmp.Core.Tests.CommandExecution; | ||
|
||
internal sealed class TestExecuteCommandClearUserSettings : CommandCliTests | ||
{ | ||
[Test] | ||
public void Test_ClearUserSettings() | ||
{ | ||
var invoker = GetInvoker(); | ||
var activator = GetActivator(); | ||
|
||
UserSettings.Wait5SecondsAfterStartupUI = false; | ||
|
||
invoker.ExecuteCommand(typeof(ExecuteCommandSetUserSetting), new CommandLineObjectPicker(new[] { nameof(UserSettings.Wait5SecondsAfterStartupUI), "true" }, activator)); | ||
|
||
Assert.IsTrue(UserSettings.Wait5SecondsAfterStartupUI); | ||
invoker.ExecuteCommand(typeof(ExecuteCommandSetUserSetting), new CommandLineObjectPicker(new[] { nameof(UserSettings.Wait5SecondsAfterStartupUI), "false" }, activator)); | ||
Assert.IsFalse(UserSettings.Wait5SecondsAfterStartupUI); | ||
invoker.ExecuteCommand(typeof(ExecuteCommandClearUserSettings), new CommandLineObjectPicker(System.Array.Empty<string>(), activator)); | ||
|
||
Assert.IsTrue(UserSettings.Wait5SecondsAfterStartupUI); | ||
} | ||
} |
24 changes: 24 additions & 0 deletions
24
Rdmp.Core/CommandExecution/AtomicCommands/ExecuteCommandClearUserSettings.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// Copyright (c) The University of Dundee 2018-2019 | ||
// This file is part of the Research Data Management Platform (RDMP). | ||
// RDMP is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. | ||
// RDMP is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. | ||
// You should have received a copy of the GNU General Public License along with RDMP. If not, see <https://www.gnu.org/licenses/>. | ||
|
||
using Rdmp.Core.ReusableLibraryCode.Settings; | ||
|
||
namespace Rdmp.Core.CommandExecution.AtomicCommands; | ||
|
||
public class ExecuteCommandClearUserSettings : BasicCommandExecution | ||
{ | ||
public ExecuteCommandClearUserSettings(IBasicActivateItems activator):base(activator) | ||
{ | ||
|
||
} | ||
public override void Execute() | ||
{ | ||
base.Execute(); | ||
|
||
UserSettings.ClearUserSettings(); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters