Skip to content

Commit cf23df1

Browse files
committed
Automate getting inspections label.
1 parent fd081d6 commit cf23df1

File tree

3 files changed

+32
-7
lines changed

3 files changed

+32
-7
lines changed

RetailCoder.VBE/UI/Settings/InspectionSettings.xaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
</UserControl.Resources>
3434
<Grid>
3535
<DockPanel Margin="5,5,5,0">
36-
<Label DockPanel.Dock="Top" Background="DarkGray" Foreground="White" FontWeight="SemiBold" Content="{Resx ResxName=Rubberduck.UI.RubberduckUI, Key=SettingsCaption_CodeInspections}" Margin="0,0,0,3">
36+
<Label DockPanel.Dock="Top" Background="DarkGray" Foreground="White" FontWeight="SemiBold" Content="{Resx ResxName=Rubberduck.UI.RubberduckUI, Key=SettingsCaption_InspectionSettings}" Margin="0,0,0,3">
3737
<Label.Style>
3838
<Style>
3939
<Style.Resources>

RetailCoder.VBE/UI/Settings/SettingsControlViewModel.cs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ namespace Rubberduck.UI.Settings
99
{
1010
public class SettingsView
1111
{
12-
public string Label { get; set; }
12+
public string Label { get { return RubberduckUI.ResourceManager.GetString("SettingsCaption_" + View); } }
1313
public string Instructions
1414
{
1515
get
@@ -35,31 +35,26 @@ public SettingsControlViewModel(IGeneralConfigService configService, SettingsVie
3535
{
3636
new SettingsView
3737
{
38-
Label = RubberduckUI.SettingsCaption_GeneralSettings,
3938
Control = new GeneralSettings(new GeneralSettingsViewModel(_config)),
4039
View = Settings.SettingsViews.GeneralSettings
4140
},
4241
new SettingsView
4342
{
44-
Label = RubberduckUI.SettingsCaption_TodoSettings,
4543
Control = new TodoSettings(new TodoSettingsViewModel(_config)),
4644
View = Settings.SettingsViews.TodoSettings
4745
},
4846
new SettingsView
4947
{
50-
Label = RubberduckUI.SettingsCaption_InspectionSettings,
5148
Control = new InspectionSettings(new InspectionSettingsViewModel(_config)),
5249
View = Settings.SettingsViews.InspectionSettings
5350
},
5451
new SettingsView
5552
{
56-
Label = RubberduckUI.SettingsCaption_UnitTestSettings,
5753
Control = new UnitTestSettings(new UnitTestSettingsViewModel(_config)),
5854
View = Settings.SettingsViews.UnitTestSettings
5955
},
6056
new SettingsView
6157
{
62-
Label = RubberduckUI.SettingsCaption_IndenterSettings,
6358
Control = new IndenterSettings(new IndenterSettingsViewModel(_config)),
6459
View = Settings.SettingsViews.IndenterSettings
6560
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
using System.Collections.Generic;
2+
using Microsoft.VisualStudio.TestTools.UnitTesting;
3+
using Rubberduck.Inspections;
4+
using Rubberduck.Settings;
5+
using Rubberduck.UI.Settings;
6+
7+
namespace RubberduckTests.Settings
8+
{
9+
[TestClass]
10+
public class SettingsControlTests
11+
{
12+
[TestMethod]
13+
public void DefaultViewIsGeneralSettings()
14+
{
15+
var configLoader = new ConfigurationLoader(new List<IInspection>());
16+
var viewModel = new SettingsControlViewModel(configLoader);
17+
18+
Assert.AreEqual(SettingsViews.GeneralSettings, viewModel.SelectedSettingsView.View);
19+
}
20+
21+
[TestMethod]
22+
public void PassedInViewIsSelected()
23+
{
24+
var configLoader = new ConfigurationLoader(new List<IInspection>());
25+
var viewModel = new SettingsControlViewModel(configLoader, SettingsViews.TodoSettings);
26+
27+
Assert.AreEqual(SettingsViews.TodoSettings, viewModel.SelectedSettingsView.View);
28+
}
29+
}
30+
}

0 commit comments

Comments
 (0)