Skip to content

Commit 868048f

Browse files
committed
Fix test
1 parent 5e3e646 commit 868048f

File tree

4 files changed

+29
-18
lines changed

4 files changed

+29
-18
lines changed

RetailCoder.VBE/Settings/ExperimentalFeatures.cs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,5 +35,20 @@ public override string ToString()
3535
{
3636
return Key;
3737
}
38+
39+
public override bool Equals(object obj)
40+
{
41+
return obj is ExperimentalFeatures value &&
42+
value.IsEnabled == IsEnabled &&
43+
value.Key == Key;
44+
}
45+
46+
public override int GetHashCode()
47+
{
48+
unchecked
49+
{
50+
return (IsEnabled.GetHashCode() * 397) ^ (Key != null ? Key.GetHashCode() : 0);
51+
}
52+
}
3853
}
3954
}

RetailCoder.VBE/UI/Settings/GeneralSettingsViewModel.cs

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -159,20 +159,6 @@ public MinimumLogLevel SelectedLogLevel
159159
}
160160
}
161161

162-
private bool _sourceControlEnabled;
163-
public bool SourceControlEnabled
164-
{
165-
get => _sourceControlEnabled;
166-
set
167-
{
168-
if (_sourceControlEnabled != value)
169-
{
170-
_sourceControlEnabled = value;
171-
OnPropertyChanged();
172-
}
173-
}
174-
}
175-
176162
public CommandBase ShowLogFolderCommand { get; }
177163

178164
private void ShowLogFolder()

Retailcoder.VBE/UI/RubberduckUI.resx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2052,14 +2052,14 @@ Would you like to import them to Rubberduck?</value>
20522052
<value>Method '{0}' is an implementation of event '{1}.{2}'. Rename event '{2}' instead?</value>
20532053
<comment>0: Selected target Identifier; 1: Event Parent; 2: Event name</comment>
20542054
</data>
2055-
<data name="GeneralSettings_EnableExperimentalFeatures" xml:space="preserve">
2056-
<value>Enable experimental features. Requires a restart to take effect.</value>
2055+
<data name="GeneralSettings_EnableSourceControl" xml:space="preserve">
2056+
<value>Enable Source Control.</value>
20572057
</data>
20582058
<data name="GeneralSettings_ExperimentalFeaturesWarning" xml:space="preserve">
20592059
<value>Only enable these if you know what you're doing. Enabling and/or using features from this section may result in things breaking unexpectedly and irrevocable data loss.</value>
20602060
</data>
20612061
<data name="GeneralSettings_ExperimentalFeatures" xml:space="preserve">
2062-
<value>Experimental Features:</value>
2062+
<value>Experimental Features (Requires a restart to take effect):</value>
20632063
</data>
20642064
<data name="ToolsMenu_ExportProject" xml:space="preserve">
20652065
<value>Export Active Project...</value>

RubberduckTests/Settings/GeneralSettingsTests.cs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1+
using System.Collections.Generic;
12
using System.Linq;
23
using Microsoft.VisualStudio.TestTools.UnitTesting;
34
using Rubberduck.Settings;
45
using Rubberduck.UI.Settings;
56
using GeneralSettings = Rubberduck.Settings.GeneralSettings;
67
using Rubberduck.Common;
78
using Moq;
9+
using Rubberduck.UI;
810

911
namespace RubberduckTests.Settings
1012
{
@@ -23,6 +25,14 @@ private Configuration GetDefaultConfig()
2325
Language = new DisplayLanguageSetting("en-US"),
2426
IsAutoSaveEnabled = false,
2527
AutoSavePeriod = 10,
28+
EnableExperimentalFeatures = new List<ExperimentalFeatures>
29+
{
30+
new ExperimentalFeatures
31+
{
32+
Key = nameof(RubberduckUI.GeneralSettings_EnableSourceControl),
33+
IsEnabled = true
34+
}
35+
}
2636
//Delimiter = '.'
2737
};
2838

@@ -142,7 +152,7 @@ public void SourceControlEnabledIsSetInCtor()
142152
var defaultConfig = GetDefaultConfig();
143153
var viewModel = new GeneralSettingsViewModel(defaultConfig, GetOperatingSystemMock().Object);
144154

145-
Assert.AreEqual(defaultConfig.UserSettings.GeneralSettings.EnableExperimentalFeatures, viewModel.SourceControlEnabled);
155+
Assert.IsTrue(defaultConfig.UserSettings.GeneralSettings.EnableExperimentalFeatures.SequenceEqual(viewModel.ExperimentalFeatures));
146156
}
147157

148158
//[TestCategory("Settings")]

0 commit comments

Comments
 (0)