#develop (short for SharpDevelop) is a free IDE for .NET programming languages.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

96 lines
2.4 KiB

// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Matthew Ward" email="mrward@users.sourceforge.net"/>
// <version>$Revision$</version>
// </file>
using ICSharpCode.WixBinding;
using NUnit.Framework;
using System;
using System.Drawing;
using System.Windows.Forms;
using System.Xml;
using WixBinding;
using WixBinding.Tests.Utils;
namespace WixBinding.Tests.DialogLoading
{
/// <summary>
/// Tests the loading of a simple Wix dialog that contains a masked edit text box.
/// </summary>
[TestFixture]
public class MaskedEditTestFixture : DialogLoadingTestFixtureBase
{
string name;
string text;
Point location;
Size size;
[TestFixtureSetUp]
public void SetUpFixture()
{
CreatedComponents.Clear();
WixDocument doc = new WixDocument();
doc.LoadXml(GetWixXml());
WixDialog wixDialog = doc.CreateWixDialog("WelcomeDialog", new MockTextFileReader());
using (Form dialog = wixDialog.CreateDialog(this)) {
MaskedTextBox textBox = (MaskedTextBox)dialog.Controls[0];
name = textBox.Name;
text = textBox.Text;
location = textBox.Location;
size = textBox.Size;
}
}
[Test]
public void Name()
{
Assert.AreEqual("ControlId", name);
}
[Test]
public void Text()
{
Assert.AreEqual("Text", text);
}
[Test]
public void TwoControlsCreated()
{
Assert.AreEqual(2, CreatedComponents.Count);
}
[Test]
public void Location()
{
int expectedX = Convert.ToInt32(10 * WixDialog.InstallerUnit);
int expectedY = Convert.ToInt32(10 * WixDialog.InstallerUnit);
Point expectedPoint = new Point(expectedX, expectedY);
Assert.AreEqual(expectedPoint, location);
}
[Test]
public void Size()
{
int expectedWidth = Convert.ToInt32(50 * WixDialog.InstallerUnit);
int expectedHeight = Convert.ToInt32(15 * WixDialog.InstallerUnit);
Size expectedSize = new Size(expectedWidth, expectedHeight);
Assert.AreEqual(expectedSize, size);
}
string GetWixXml()
{
return "<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi'>\r\n" +
"\t<Fragment>\r\n" +
"\t\t<UI>\r\n" +
"\t\t\t<Dialog Id='WelcomeDialog' Height='270' Width='370'>\r\n" +
"\t\t\t\t<Control Id='ControlId' Type='MaskedEdit' X='10' Y='10' Width='50' Height='15' Text='Text'/>\r\n" +
"\t\t\t</Dialog>\r\n" +
"\t\t</UI>\r\n" +
"\t</Fragment>\r\n" +
"</Wix>";
}
}
}