Skip to content

Commit

Permalink
Changing expectations in tests now that Error/Audit instance Conventi…
Browse files Browse the repository at this point in the history
…onName is prefilled
  • Loading branch information
DavidBoike committed Dec 7, 2023
1 parent b7e139e commit 84f61ec
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 11 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
namespace ServiceControl.Config.Tests
{
using System;
using System.ComponentModel;
using NUnit.Framework;
using ServiceControlInstaller.Engine.Configuration.ServiceControl;
Expand All @@ -8,6 +9,9 @@

class AddErrorInstanceScreenLoadedTests
{
static readonly string programDataPath = Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData);
static readonly string programX86Path = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86);

[Test]
public void Error_and_Audit_Instances_are_selected_for_install()
{
Expand Down Expand Up @@ -148,11 +152,11 @@ public void Destination_path_is_null()

var errorInfo = (INotifyDataErrorInfo)viewModel;

Assert.IsNull(viewModel.ErrorDestinationPath);
Assert.That(viewModel.ErrorDestinationPath, Is.EqualTo($@"{programX86Path}\Particular Software\Particular.ServiceControl"));

Assert.IsEmpty(errorInfo.GetErrors(nameof(viewModel.ErrorDestinationPath)));

Assert.IsNull(viewModel.AuditDestinationPath);
Assert.That(viewModel.AuditDestinationPath, Is.EqualTo($@"{programX86Path}\Particular Software\Particular.ServiceControl.Audit"));

Assert.IsEmpty(errorInfo.GetErrors(nameof(viewModel.AuditDestinationPath)));
}
Expand All @@ -164,11 +168,11 @@ public void Log_path_is_null()

var errorInfo = (INotifyDataErrorInfo)viewModel;

Assert.IsNull(viewModel.ErrorLogPath);
Assert.That(viewModel.ErrorLogPath, Is.EqualTo($@"{programDataPath}\Particular\ServiceControl\Particular.ServiceControl\Logs"));

Assert.IsEmpty(errorInfo.GetErrors(nameof(viewModel.ErrorLogPath)));

Assert.IsNull(viewModel.AuditLogPath);
Assert.That(viewModel.AuditLogPath, Is.EqualTo($@"{programDataPath}\Particular\ServiceControl\Particular.ServiceControl.Audit\Logs"));

Assert.IsEmpty(errorInfo.GetErrors(nameof(viewModel.AuditLogPath)));
}
Expand All @@ -181,11 +185,11 @@ public void Database_path_is_null()

var errorInfo = (INotifyDataErrorInfo)viewModel;

Assert.IsNull(viewModel.ErrorDatabasePath);
Assert.That(viewModel.ErrorDatabasePath, Is.EqualTo($@"{programDataPath}\Particular\ServiceControl\Particular.ServiceControl\DB"));

Assert.IsEmpty(errorInfo.GetErrors(nameof(viewModel.ErrorDatabasePath)));

Assert.IsNull(viewModel.AuditDatabasePath);
Assert.That(viewModel.AuditDatabasePath, Is.EqualTo($@"{programDataPath}\Particular\ServiceControl\Particular.ServiceControl.Audit\DB"));

Assert.IsEmpty(errorInfo.GetErrors(nameof(viewModel.AuditDatabasePath)));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ public void Convention_name_cannot_be_empty_when_instance_names_are_not_provided

var notifyErrorInfo = GetNotifyErrorInfo(viewModel);

Assert.IsFalse(instanceNamesProvided);
Assert.That(instanceNamesProvided); // Provided because the convention default auto-fills them on instantiation

Assert.IsNotEmpty(notifyErrorInfo.GetErrors(nameof(viewModel.ConventionName)));
Assert.IsEmpty(notifyErrorInfo.GetErrors(nameof(viewModel.ConventionName)));
}

[Test]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ public void Convention_name_cannot_be_empty_when_instance_names_are_not_provided

var notifyErrorInfo = GetNotifyErrorInfo(viewModel);

Assert.IsFalse(instanceNamesProvided);
Assert.That(instanceNamesProvided); // Provided because the convention default auto-fills them on instantiation

Assert.IsNotEmpty(notifyErrorInfo.GetErrors(nameof(viewModel.ConventionName)));
Assert.IsEmpty(notifyErrorInfo.GetErrors(nameof(viewModel.ConventionName)));
}

[Test]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public ServiceControlAddViewModel()
while (ConventionName != ErrorInstanceName)
{
ConventionName = $"Particular.ServiceControl.{++i}";
OnConventionNameChanged();
// ErrorInstanceName updated via OnConventionNameChanged added by Fody
}
}

Expand Down

0 comments on commit 84f61ec

Please sign in to comment.