Do not set the owner form within the NewDiskDialog constructor; it should be

set by the caller. Test corrections so they don't time out due to blocking
open dialogs. Some tidying up.

Signed-off-by: Konstantina Chremmou <konstantina.chremmou@citrix.com>
This commit is contained in:
Konstantina Chremmou 2019-01-13 00:39:12 +00:00 committed by Mihaela Stoica
parent 58b65f8a8a
commit 0567d838df
10 changed files with 155 additions and 215 deletions

View File

@ -1,5 +1,3 @@
using System;
namespace XenAdmin.Dialogs
{
partial class NewDiskDialog
@ -67,6 +65,7 @@ namespace XenAdmin.Dialogs
0,
0,
0});
this.DiskSizeNumericUpDown.TextChanged += new System.EventHandler(this.DiskSizeNumericUpDown_TextChanged);
this.DiskSizeNumericUpDown.ValueChanged += new System.EventHandler(this.DiskSizeNumericUpDown_ValueChanged);
this.DiskSizeNumericUpDown.KeyUp += new System.Windows.Forms.KeyEventHandler(this.DiskSizeNumericUpDown_KeyUp);
//
@ -172,6 +171,7 @@ namespace XenAdmin.Dialogs
resources.GetString("comboBoxUnits.Items"),
resources.GetString("comboBoxUnits.Items1")});
this.comboBoxUnits.Name = "comboBoxUnits";
this.comboBoxUnits.SelectedIndexChanged += new System.EventHandler(this.comboBoxUnits_SelectedIndexChanged);
//
// label4
//

View File

@ -45,6 +45,10 @@ namespace XenAdmin.Dialogs
{
public partial class NewDiskDialog : XenDialogBase
{
private enum DiskSizeUnits { MB, GB }
#region Private fields
private readonly VM TheVM;
private readonly SR TheSR;
@ -57,64 +61,59 @@ namespace XenAdmin.Dialogs
private bool SelectionNull = true;
private readonly IEnumerable<VDI> _VDINamesInUse = new List<VDI>();
private const int DecimalPlacesGB = 3; // show 3 decimal places for GB (CA-91322)
private const int DecimalPlacesMB = 0;
private const int IncrementGB = 1;
private const int IncrementMB = 256;
private const decimal MinimumDiskSizeGB = 0.001m;
private const int MinimumDiskSizeMB = 1;
private DiskSizeUnits currentSelectedUnits = DiskSizeUnits.GB;
#endregion
#region Constructors
private NewDiskDialog(IXenConnection connection, IEnumerable<VDI> vdiNamesInUse)
: base(connection)
{
if (connection == null) throw new ArgumentNullException("connection");
_VDINamesInUse = vdiNamesInUse;
if (connection == null)
throw new ArgumentNullException("connection");
InitializeComponent();
InitDialog(connection);
}
private void InitDialog(IXenConnection connection)
{
this.Owner = Program.MainWindow;
_VDINamesInUse = vdiNamesInUse;
SrListBox.Connection = connection;
// Add events
NameTextBox.Text = GetDefaultVDIName();
srListBox_SelectedIndexChanged(null, null);
DiskSizeNumericUpDown.TextChanged += DiskSizeNumericUpDown_TextChanged;
max = (decimal)Math.Pow(1024, 4);//1 Petabit
min = 0;
comboBoxUnits.SelectedItem = comboBoxUnits.Items[0];
comboBoxUnits.SelectedIndexChanged += comboBoxUnits_SelectedIndexChanged;
SetNumUpDownIncrementAndDecimals(DiskSizeNumericUpDown, comboBoxUnits.SelectedItem.ToString());
updateErrorsAndButtons();
}
public NewDiskDialog(IXenConnection connection, SR sr)
: this(connection, new List<VDI>())
{
TheSR = sr;
PickerUsage = SrPicker.SRPickerType.InstallFromTemplate;
SrListBox.Usage = SrPicker.SRPickerType.InstallFromTemplate;
SrListBox.SetAffinity(null);
SrListBox.selectSRorNone(TheSR);
}
private SrPicker.SRPickerType PickerUsage
{
set { SrListBox.Usage = value; }
}
public NewDiskDialog(IXenConnection connection, VM vm, VDI diskTemplate, Host affinity, bool canResize, long minSize, IEnumerable<VDI> vdiNamesInUse)
: this(connection, vm, SrPicker.SRPickerType.VM, diskTemplate, affinity, canResize, minSize, vdiNamesInUse)
{
}
public NewDiskDialog(IXenConnection connection, VM vm)
: this(connection, vm, null, vm.Home(), true, 0, new List<VDI>()) { }
: this(connection, vm, SrPicker.SRPickerType.VM, null, vm.Home(), true, 0, new List<VDI>())
{ }
public NewDiskDialog(IXenConnection connection, VM vm, SrPicker.SRPickerType PickerUsage, VDI diskTemplate, Host affinity, bool canResize, long minSize, IEnumerable<VDI> vdiNamesInUse)
public NewDiskDialog(IXenConnection connection, VM vm, SrPicker.SRPickerType pickerUsage, VDI diskTemplate,
Host affinity, bool canResize, long minSize, IEnumerable<VDI> vdiNamesInUse)
: this(connection, vdiNamesInUse)
{
TheVM = vm;
DiskTemplate = diskTemplate;
CanResize = canResize;
MinSize = minSize;
this.PickerUsage = PickerUsage;
SrListBox.Usage = pickerUsage;
SrListBox.SetAffinity(affinity);
Pool pool_sr = Helpers.GetPoolOfOne(connection);
@ -127,6 +126,8 @@ namespace XenAdmin.Dialogs
LoadValues();
}
#endregion
private void LoadValues()
{
if (DiskTemplate == null)
@ -152,11 +153,6 @@ namespace XenAdmin.Dialogs
OkButton.Text = Messages.OK;
}
private const int DecimalPlacesGB = 3; // show 3 decimal places for GB (CA-91322)
private const int DecimalPlacesMB = 0;
private const int IncrementGB = 1;
private const int IncrementMB = 256;
private string GetDefaultVDIName()
{
List<string> usedNames = new List<string>();
@ -172,7 +168,7 @@ namespace XenAdmin.Dialogs
SelectionNull = obj == null;
}
void srListBox_SelectedIndexChanged(object sender, EventArgs e)
private void srListBox_SelectedIndexChanged(object sender, EventArgs e)
{
updateErrorsAndButtons();
}
@ -334,17 +330,12 @@ namespace XenAdmin.Dialogs
updateErrorsAndButtons();
}
private enum DiskSizeUnits { MB, GB }
private DiskSizeUnits SelectedUnits
{
get { return comboBoxUnits.SelectedIndex == 0 ? DiskSizeUnits.GB : DiskSizeUnits.MB; }
set { comboBoxUnits.SelectedIndex = value == DiskSizeUnits.GB ? 0 : 1; }
}
private const decimal MinimumDiskSizeGB = 0.001m;
private const int MinimumDiskSizeMB = 1;
private decimal GetDiskTooSmallMessageMinSize()
{
return min == 0 ? SelectedUnits == DiskSizeUnits.GB ? MinimumDiskSizeGB : MinimumDiskSizeMB : min;
@ -439,19 +430,7 @@ namespace XenAdmin.Dialogs
Close();
}
private bool dontCreateVDI;
public bool DontCreateVDI
{
get
{
return dontCreateVDI;
}
set
{
dontCreateVDI = value;
}
}
public bool DontCreateVDI { get; set; }
private void DiskSizeNumericUpDown_ValueChanged(object sender, EventArgs e)
{
@ -497,7 +476,6 @@ namespace XenAdmin.Dialogs
min = (decimal)((double)MinSize / GetUnits());
}
private DiskSizeUnits currentSelectedUnits = DiskSizeUnits.GB;
private void comboBoxUnits_SelectedIndexChanged(object sender, EventArgs e)
{
//Check if the new unit is different than the previous one otherwise discard the change

View File

@ -155,13 +155,15 @@ namespace XenAdmin.Wizards.NewVMWizard
private void AddButton_Click(object sender, EventArgs e)
{
NewDiskDialog dialog = new NewDiskDialog(Connection, Template, SrPicker.SRPickerType.LunPerVDI, null, Affinity, true, 0, AddedVDIs);
dialog.DontCreateVDI = true;
if (dialog.ShowDialog() != DialogResult.OK)
return;
using (var dialog = new NewDiskDialog(Connection, Template, SrPicker.SRPickerType.LunPerVDI, null, Affinity,
true, 0, AddedVDIs) {DontCreateVDI = true})
{
if (dialog.ShowDialog() != DialogResult.OK)
return;
DisksGridView.Rows.Add(new DiskGridRowItem(Connection, dialog.NewDisk(), dialog.NewDevice(), true, Affinity));
UpdateEnablement();
DisksGridView.Rows.Add(new DiskGridRowItem(Connection, dialog.NewDisk(), dialog.NewDevice(), true, Affinity));
UpdateEnablement();
}
}
private void DisksRadioButton_CheckedChanged(object sender, EventArgs e)
@ -293,17 +295,19 @@ namespace XenAdmin.Wizards.NewVMWizard
if (DisksGridView.SelectedRows.Count <= 0)
return;
DiskGridRowItem selectedItem = ((DiskGridRowItem)DisksGridView.SelectedRows[0]);
DiskGridRowItem selectedItem = (DiskGridRowItem) DisksGridView.SelectedRows[0];
NewDiskDialog dialog = new NewDiskDialog(Connection, Template, SrPicker.SRPickerType.LunPerVDI, selectedItem.Disk, Affinity, selectedItem.CanResize, selectedItem.MinSize, AddedVDIs);
dialog.DontCreateVDI = true;
if (dialog.ShowDialog() != DialogResult.OK)
return;
using (var dialog = new NewDiskDialog(Connection, Template, SrPicker.SRPickerType.LunPerVDI,
selectedItem.Disk, Affinity, selectedItem.CanResize, selectedItem.MinSize, AddedVDIs)
{DontCreateVDI = true})
{
if (dialog.ShowDialog(ParentForm) != DialogResult.OK)
return;
selectedItem.Disk = dialog.NewDisk();
selectedItem.UpdateDetails();
UpdateEnablement();
selectedItem.Disk = dialog.NewDisk();
selectedItem.UpdateDetails();
UpdateEnablement();
}
}
#region Accessors

View File

@ -29,13 +29,11 @@
* SUCH DAMAGE.
*/
using System;
using System.Collections.Generic;
using System.Text;
using System.Linq;
using XenAdmin.Commands;
using XenAdmin.ServerDBs;
using XenAPI;
using XenAdmin.Core;
using NUnit.Framework;
namespace XenAdminTests.CommandTests
@ -83,15 +81,18 @@ namespace XenAdminTests.CommandTests
{
int vbdCount = DbProxy.proxys[vm.Connection].db.Tables["vbd"].Rows.Count;
MW(delegate
MW(()=> MainWindowWrapper.StorageMenuItems.AddVirtualDiskToolStripMenuItemInStorageMenu.PerformClick());
MWWaitFor(() => MainWindowWrapper.OwnedForms.Length > 0);
MW(() =>
{
MainWindowWrapper.StorageMenuItems.AddVirtualDiskToolStripMenuItemInStorageMenu.PerformClick();
NewDiskDialogWrapper newDiskDialogWrapper = new NewDiskDialogWrapper(WaitForWindowToAppear("Add Virtual Disk"));
newDiskDialogWrapper.OkButton.PerformClick();
var dialog = MainWindowWrapper.OwnedForms.FirstOrDefault(w => w.Text == "Add Virtual Disk");
TestUtils.GetButton(dialog, "OkButton").PerformClick();
});
// wait until command finished.
MWWaitFor(() => DbProxy.proxys[vm.Connection].db.Tables["vbd"].Rows.Count == vbdCount + 1, "AddVirtualDiskCommandTest didn't finish.");
MWWaitFor(() => DbProxy.proxys[vm.Connection].db.Tables["vbd"].Rows.Count == vbdCount + 1,
"AddVirtualDiskCommandTest didn't finish.");
}
}

View File

@ -29,11 +29,8 @@
* SUCH DAMAGE.
*/
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using NUnit.Framework;
using XenAdmin;
using XenAdmin.Dialogs;
namespace XenAdminTests.DialogTests
@ -47,11 +44,11 @@ namespace XenAdminTests.DialogTests
{
RunBefore();
dialog = MW<T>(NewDialog);
dialog = MW(NewDialog);
RunBeforeShow();
MW(dialog.Show);
MW(()=>dialog.Show(Program.MainWindow));
// Check that if we have a help button, we have help
if (dialog.HelpButton)

View File

@ -1,55 +0,0 @@
/* Copyright (c) Citrix Systems, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms,
* with or without modification, are permitted provided
* that the following conditions are met:
*
* * Redistributions of source code must retain the above
* copyright notice, this list of conditions and the
* following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the
* following disclaimer in the documentation and/or other
* materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
using System.Windows.Forms;
using XenAdmin.Controls;
using XenAdmin.Dialogs;
namespace XenAdminTests
{
internal class NewDiskDialogWrapper : TestWrapper<NewDiskDialog>
{
public NewDiskDialogWrapper(IWin32Window window)
: base(window)
{
}
public Button OkButton
{
get { return TestUtils.GetButton(Item, "OkButton"); }
}
public SrPicker SrListBox
{
get { return TestUtils.GetSrPicker(Item, "SrListBox"); }
}
}
}

View File

@ -30,17 +30,13 @@
*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Windows.Forms;
using NUnit.Framework;
using XenAdmin;
using XenAdmin.Controls;
using XenAdmin.Controls.DataGridViewEx;
using XenAdmin.Controls.MainWindowControls;
using XenAdmin.Dialogs;
using XenAdmin.Controls.XenSearch;
namespace XenAdminTests
@ -68,7 +64,7 @@ namespace XenAdminTests
}
catch (Exception e)
{
Assert.Fail(string.Format("Field {0} of {1} throws {2}: {3}.", parts[0], o.GetType().Name, e.GetType().Name, e.Message));
Assert.Fail($"Field {parts[0]} of {o.GetType().Name} throws {e.GetType().Name}: {e.Message}.");
}
if (parts.Length == 1)

View File

@ -29,24 +29,23 @@
* SUCH DAMAGE.
*/
using System;
using System.Collections.Generic;
using System.Text;
using System.Linq;
using System.Threading;
using NUnit.Framework;
using XenAdmin.Wizards.NewVMWizard;
using XenAPI;
using XenAdmin.ServerDBs;
using XenAdmin;
using System.Threading;
using XenAdminTests.CommandTests;
using XenAdmin.Actions.VMActions;
using System.Windows.Forms;
using XenAdmin.Controls;
namespace XenAdminTests.WizardTests.state5_xml
{
/// <summary>
/// Tests that VM.Clone is called when using the New VM Wizard with a user template with default storage settings.
/// </summary>
[TestFixture, Category(TestCategories.UICategoryB)]
[TestFixture]
[Category(TestCategories.UICategoryB)]
[Description("Tests that VM.Clone is called when using the New VM Wizard " +
"with a user template with default storage settings.")]
public class NewVMWizardTestUserTemplateClone : WizardTest<NewVMWizard>
{
private bool _cloneInvoked;
@ -81,10 +80,11 @@ namespace XenAdminTests.WizardTests.state5_xml
}
}
/// <summary>
/// Tests that VM.Copy is called when using the New VM Wizard with a user-template when the user unchecks the clone checkbox.
/// </summary>
[TestFixture, Category(TestCategories.UICategoryB)]
[TestFixture]
[Category(TestCategories.UICategoryB)]
[Description("Tests that VM.Copy is called when using the New VM Wizard " +
"with a user-template when the user unchecks the clone checkbox.")]
public class NewVMWizardTestUserTemplateCopy : WizardTest<NewVMWizard>
{
private bool _copyInvoked;
@ -122,14 +122,14 @@ namespace XenAdminTests.WizardTests.state5_xml
{
if (pageName == "Storage")
{
var cloneCheckBosx = TestUtils.GetCheckBox(wizard, "page_6_Storage.CloneCheckBox");
var cloneCheckBox = TestUtils.GetCheckBox(wizard, "page_6_Storage.CloneCheckBox");
MW(delegate
{
Assert.IsTrue(cloneCheckBosx.Enabled, "Clone checkbox wasn't enabled.");
Assert.IsTrue(cloneCheckBosx.Checked, "Clone checkbox wasn't checked.");
Assert.IsTrue(cloneCheckBox.Enabled, "Clone checkbox wasn't enabled.");
Assert.IsTrue(cloneCheckBox.Checked, "Clone checkbox wasn't checked.");
cloneCheckBosx.Checked = false;
cloneCheckBox.Checked = false;
});
}
@ -137,12 +137,12 @@ namespace XenAdminTests.WizardTests.state5_xml
}
}
/// <summary>
/// Tests that VM.Copy is called when using the New VM Wizard with a user-template when one of the 2 target disks has a
/// different SR.
/// </summary>
[TestFixture, Category(TestCategories.UICategoryB)]
public class NewVMWizardTestUserTemplateCopy2 : WizardTest<NewVMWizard>
[TestFixture]
[Category(TestCategories.UICategoryB)]
[Description("Tests that VM.Copy is called when using the New VM Wizard " +
"with a user-template when one of the 2 target disks has a different SR.")]
public class NewVMWizardTestUserTemplateCopy2 : NewVMWizardTest
{
private bool _cloneInvoked;
@ -179,34 +179,29 @@ namespace XenAdminTests.WizardTests.state5_xml
{
if (pageName == "Storage")
{
var cloneCheckBosx = TestUtils.GetCheckBox(wizard, "page_6_Storage.CloneCheckBox");
var propertiesButton = TestUtils.GetButton(wizard, "page_6_Storage.PropertiesButton");
var cloneCheckBox = TestUtils.GetCheckBox(wizard, "page_6_Storage.CloneCheckBox");
var gridView = TestUtils.GetDataGridView(wizard, "page_6_Storage.DisksGridView");
HandleModalDialog("Edit Disk", propertiesButton.PerformClick,
delegate(NewDiskDialogWrapper w)
{
w.SrListBox.selectSRorDefaultorAny(GetAnySR(sr => sr.Name().Contains("SCSI"))); //switch storage for new disk
w.OkButton.PerformClick();
});
foreach (DiskGridRowItem item in gridView.Rows)
{
ChangeDiskStorageToIscsi(item);
break; //change only one disk
}
MWWaitFor(() => wizard.Visible && wizard.CanFocus);
while (!btnNext.Enabled)
Thread.Sleep(1000);
Assert.IsTrue(cloneCheckBosx.Enabled, "Clone checkbox wasn't enabled");
Assert.IsTrue(cloneCheckBosx.Checked, "Clone checkbox wasn't checked");
Assert.IsTrue(cloneCheckBox.Enabled, "Clone checkbox wasn't enabled");
Assert.IsTrue(cloneCheckBox.Checked, "Clone checkbox wasn't checked");
}
base.TestPage(pageName);
}
}
/// <summary>
/// Tests that VM.Copy is called when using the New VM Wizard with a user-template when the user selects all disks to be a different
/// storage than the source.
/// </summary>
[TestFixture, Category(TestCategories.UICategoryB)]
public class NewVMWizardTestUserTemplateCopy3 : WizardTest<NewVMWizard>
[TestFixture]
[Category(TestCategories.UICategoryB)]
[Description("Tests that VM.Copy is called when using the New VM Wizard with a user-template " +
"and the user selects all disks to be on a storage different from the source.")]
public class NewVMWizardTestUserTemplateCopy3 : NewVMWizardTest
{
private bool _copyInvoked;
@ -244,36 +239,24 @@ namespace XenAdminTests.WizardTests.state5_xml
if (pageName == "Storage")
{
var cloneCheckBox = TestUtils.GetCheckBox(wizard, "page_6_Storage.CloneCheckBox");
var propertiesButton = TestUtils.GetButton(wizard, "page_6_Storage.PropertiesButton");
var gridView = TestUtils.GetDataGridView(wizard, "page_6_Storage.DisksGridView");
foreach (DiskGridRowItem item in gridView.Rows)
{
MW(() => item.Selected = true);
ChangeDiskStorageToIscsi(item);
HandleModalDialog<NewDiskDialogWrapper>("Edit Disk", propertiesButton.PerformClick,
delegate(NewDiskDialogWrapper w)
{
w.SrListBox.selectSRorDefaultorAny(GetAnySR(sr => sr.Name().Contains("SCSI"))); //switch storage for new disk
w.OkButton.PerformClick();
});
}
MW(delegate
{
Assert.IsFalse(cloneCheckBox.Enabled, "clone checkbox was enabled.");
Assert.IsFalse(cloneCheckBox.Checked, "clone checkbox was checked.");
});
Assert.IsFalse(cloneCheckBox.Enabled, "clone checkbox was enabled.");
Assert.IsFalse(cloneCheckBox.Checked, "clone checkbox was checked.");
}
base.TestPage(pageName);
}
}
/// <summary>
/// Tests that VM.clone is called when using the New VM Wizard with a default-template when the user selects default storage settings.
/// </summary>
[TestFixture, Category(TestCategories.UICategoryB)]
[TestFixture]
[Category(TestCategories.UICategoryB)]
[Description("Tests that VM.clone is called when using the New VM Wizard " +
"with a default-template when the user selects default storage settings.")]
public class NewVMWizardTestDefaultTemplate : WizardTest<NewVMWizard>
{
private bool _cloneInvoked;
@ -307,5 +290,40 @@ namespace XenAdminTests.WizardTests.state5_xml
Assert.IsTrue(vbds.TrueForAll(v => v.GetIsOwner() || v.IsCDROM()), "IsOwner wasn't set");
}
}
public abstract class NewVMWizardTest : WizardTest<NewVMWizard>
{
protected NewVMWizardTest(string[] pageNames, bool canFinish = true, bool doFinish = true)
: base(pageNames, canFinish, doFinish)
{
}
protected void ChangeDiskStorageToIscsi(DiskGridRowItem item)
{
var propertiesButton = TestUtils.GetButton(wizard, "page_6_Storage.PropertiesButton");
ThreadPool.QueueUserWorkItem(delegate
{
MWWaitFor(() => wizard.OwnedForms.Length > 0);
var dialog = wizard.OwnedForms.FirstOrDefault(w => w.Text == "Edit Disk");
var srPicker = TestUtils.GetSrPicker(dialog, "SrListBox");
var okButton = TestUtils.GetButton(dialog, "OkButton");
MW(() =>
{
srPicker.selectSRorDefaultorAny(GetAnySR(sr => sr.Name().Contains("SCSI")));
okButton.PerformClick();
});
});
MW(() =>
{
item.Selected = true;
propertiesButton.PerformClick();
});
MWWaitFor(() => wizard.Visible && wizard.CanFocus);
}
}
}

View File

@ -29,8 +29,8 @@
* SUCH DAMAGE.
*/
using System.Linq;
using System.Threading;
using System.Windows.Forms;
using NUnit.Framework;
using XenAdmin;
using XenAdmin.Dialogs;
@ -80,13 +80,15 @@ namespace XenAdminTests.WizardTests.state5_xml
}
else if (pageName == "Apply Upgrade")
{
var window = WaitForWindowToAppear(Messages.ROLLING_POOL_UPGRADE,
w => Control.FromHandle(w.Handle) is NonModalThreeButtonDialog);
MWWaitFor(() => wizard.OwnedForms.Length > 0);
MW(() =>
{
var dialog = Control.FromHandle(window.Handle) as Form;
if (dialog != null)
dialog.CancelButton.PerformClick();
var dialog = wizard.OwnedForms.FirstOrDefault(w =>
w.Text == Messages.ROLLING_POOL_UPGRADE && w is NonModalThreeButtonDialog);
Assert.NotNull(dialog, "Manual upgrade prompt was not found");
dialog.CancelButton.PerformClick();
});
}
}

View File

@ -76,7 +76,6 @@
<Compile Include="XenModelTests\ActionTests\ActionTest.cs" />
<Compile Include="XenModelTests\ActionTests\VMActionsTest.cs" />
<Compile Include="MainWindowWrapper\AttachDiskDialogWrapper.cs" />
<Compile Include="MainWindowWrapper\NewDiskDialogWrapper.cs" />
<Compile Include="MainWindowWrapper\AddServerDialogWrapper.cs" />
<Compile Include="MainWindowWrapper\MockMainWindow.cs" />
<Compile Include="MainWindowWrapper\NameAndConnectionPromptWrapper.cs" />