public void PopupController_ShowNameChangedConflict_SetProperties_AllPropertiesDisplayed()
{
//------------Setup for test--------------------------
var popupWasCalled = false;
string description = string.Empty;
string header = string.Empty;
string oldName = string.Empty;
string newName = string.Empty;
MessageBoxButton buttons = MessageBoxButton.YesNoCancel;
string expectedDescription = "The following task has been renamed " + oldName + " -> " + newName + ". You will lose the history for the old task." + Environment.NewLine +
" Would you like to save the new name?" + Environment.NewLine +
"-------------------------------------------------------------------" +
"Yes - Save with the new name." + Environment.NewLine +
"No - Save with the old name." + Environment.NewLine +
"Cancel - Returns you to Scheduler.";
MessageBoxImage imageType = MessageBoxImage.Error;
var popupController = new PopupController
{
ShowDev2MessageBox = (desc, hdr, btn, img, dntShwAgKy) =>
{
description = desc;
header = hdr;
buttons = btn;
imageType = img;
popupWasCalled = true;
return MessageBoxResult.OK;
}
};
//------------Execute Test---------------------------
popupController.ShowNameChangedConflict(oldName, newName);
//------------Assert Results-------------------------
Assert.IsTrue(popupWasCalled);
Assert.AreEqual(MessageBoxButton.YesNoCancel, buttons);
Assert.AreEqual("Rename conflict", header);
Assert.AreEqual(expectedDescription, description);
Assert.AreEqual(MessageBoxImage.Information, imageType);
}