// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt) // This code is distributed under the GNU LGPL (for details please see \doc\license.txt) 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 { /// /// Tests that the button text is taken from the Control's Text element if it exists otherwise /// it defaults to using the Control's Text attribute. /// [TestFixture] public class ButtonTextTestFixture : DialogLoadingTestFixtureBase { string nextButtonText; string cancelButtonText; [TestFixtureSetUp] public void SetUpFixture() { WixDocument doc = new WixDocument(); doc.LoadXml(GetWixXml()); WixDialog wixDialog = doc.CreateWixDialog("WelcomeDialog", new MockTextFileReader()); using (Form dialog = wixDialog.CreateDialog(this)) { Button nextButton = (Button)dialog.Controls[0]; nextButtonText = nextButton.Text; Button cancelButton = (Button)dialog.Controls[1]; cancelButtonText = cancelButton.Text; } } [Test] public void CancelButtonText() { Assert.AreEqual("Cancel", cancelButtonText); } [Test] public void NextButtonText() { Assert.AreEqual("Next", nextButtonText); } string GetWixXml() { return "\r\n" + "\t\r\n" + "\t\t\r\n" + "\t\t\t\r\n" + "\t\t\t\t\r\n" + "\t\t\t\t\tNext\r\n" + "\t\t\t\t\r\n" + "\t\t\t\t\r\n" + "\t\t\t\t\tCancel\r\n" + "\t\t\t\t\r\n" + "\t\t\t\r\n" + "\t\t\r\n" + "\t\r\n" + ""; } } }