Index: Core/Gui/src/Core.Gui/Forms/Backstage/AboutViewModel.cs
===================================================================
diff -u -r70a6802dad61b565c91643f4cb46ccad7db53336 -r73e942de3fe048d11e3abd2fc8024b4cfeb56f29
--- Core/Gui/src/Core.Gui/Forms/Backstage/AboutViewModel.cs (.../AboutViewModel.cs) (revision 70a6802dad61b565c91643f4cb46ccad7db53336)
+++ Core/Gui/src/Core.Gui/Forms/Backstage/AboutViewModel.cs (.../AboutViewModel.cs) (revision 73e942de3fe048d11e3abd2fc8024b4cfeb56f29)
@@ -26,6 +26,7 @@
using System.Windows;
using System.Windows.Media.Imaging;
using Core.Gui.Properties;
+using Core.Gui.Settings;
namespace Core.Gui.Forms.Backstage
{
@@ -34,14 +35,23 @@
///
public class AboutViewModel : IBackstagePageViewModel
{
+ private readonly GuiCoreSettings settings;
+
///
/// Creates a new instance of .
///
- /// The application name.
+ /// The application settings.
/// The application version.
- public AboutViewModel(string applicationName, string version)
+ /// Thrown when is null.
+ public AboutViewModel(GuiCoreSettings settings, string version)
{
- ApplicationName = applicationName;
+ if (settings == null)
+ {
+ throw new ArgumentNullException(nameof(settings));
+ }
+
+ this.settings = settings;
+
Version = version;
WindowsEdition = (string) GetManagementObjectProperty("Win32_OperatingSystem", "Caption")
@@ -55,7 +65,7 @@
///
/// Gets the application name.
///
- public string ApplicationName { get; }
+ public string ApplicationName => settings.ApplicationName;
///
/// Gets the application version.
Index: Core/Gui/test/Core.Gui.Test/Forms/Backstage/AboutViewModelTest.cs
===================================================================
diff -u -r51a9721e725b26c1cd23d0cd54dc384aa8bbb927 -r73e942de3fe048d11e3abd2fc8024b4cfeb56f29
--- Core/Gui/test/Core.Gui.Test/Forms/Backstage/AboutViewModelTest.cs (.../AboutViewModelTest.cs) (revision 51a9721e725b26c1cd23d0cd54dc384aa8bbb927)
+++ Core/Gui/test/Core.Gui.Test/Forms/Backstage/AboutViewModelTest.cs (.../AboutViewModelTest.cs) (revision 73e942de3fe048d11e3abd2fc8024b4cfeb56f29)
@@ -25,6 +25,7 @@
using System.Management;
using System.Windows;
using Core.Gui.Forms.Backstage;
+using Core.Gui.Settings;
using NUnit.Framework;
namespace Core.Gui.Test.Forms.Backstage
@@ -33,18 +34,33 @@
public class AboutViewModelTest
{
[Test]
+ public void Constructor_SettingsNull_ThrowsArgumentNullException()
+ {
+ // Call
+ void Call() => new AboutViewModel(null, string.Empty);
+
+ // Assert
+ var exception = Assert.Throws(Call);
+ Assert.AreEqual("settings", exception.ParamName);
+ }
+
+ [Test]
public void Constructor_ExpectedValues()
{
// Setup
- const string applicationName = "Test application";
+ var settings = new GuiCoreSettings
+ {
+ ApplicationName = "Test application"
+ };
+
const string version = "1.0";
// Call
- var viewModel = new AboutViewModel(applicationName, version);
+ var viewModel = new AboutViewModel(settings, version);
// Assert
Assert.IsInstanceOf(viewModel);
- Assert.AreEqual(applicationName, viewModel.ApplicationName);
+ Assert.AreEqual(settings.ApplicationName, viewModel.ApplicationName);
Assert.AreEqual(version, viewModel.Version);
ManagementObject processorManagementObject =