[Fat-develop] FAT/src/FAT.Web FixtureSpecifierControl.cs,NONE,1.1 IPage.cs,NONE,1.1 Page.cs,NONE,1.1
Brought to you by:
exortech
Update of /cvsroot/fat/FAT/src/FAT.Web In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16766/src/FAT.Web Modified Files: Default.aspx Default.aspx.cs DefaultPageModel.cs FAT.Web.csproj TestFixtureHelp.aspx.cs Added Files: FixtureSpecifierControl.cs IPage.cs Page.cs Log Message: Refactored fixture DropDownList in to FixtureSpecifierControl. --- NEW FILE: FixtureSpecifierControl.cs --- using FAT.Core; using FAT.Core.Configuration; using System; using System.Web.UI; using System.Web.UI.WebControls; namespace FAT.Web { public class FixtureSpecifierControl : Control, INamingContainer { ITestFixtureLoader loader; private DropDownList implementedFixturesDropDownList; public FixtureSpecifierControl() : this (ConfigurationFactory.Create()) {} public FixtureSpecifierControl(IConfiguration configuration) : this(new TestFixtureLoader(configuration)) {} public FixtureSpecifierControl(ITestFixtureLoader loader) { this.loader = loader; } protected override void OnLoad(EventArgs args) { if (!Page.IsPostBack) { foreach (string fixtureName in loader.GetFixtureNames()) { ImplementedFixturesDropDownList.Items.Add(new ListItem(fixtureName, fixtureName)); } } } protected override void CreateChildControls() { implementedFixturesDropDownList = new DropDownList(); implementedFixturesDropDownList.ID = "implementedFixturesDropDownList"; implementedFixturesDropDownList.Width = 500; Controls.Add(implementedFixturesDropDownList); } public string SelectedFixture { get {return ImplementedFixturesDropDownList.SelectedItem.Value;} } public DropDownList ImplementedFixturesDropDownList { get { EnsureChildControls(); return implementedFixturesDropDownList; } } protected new virtual IPage Page { get { return new Page(base.Page); } } } } --- NEW FILE: IPage.cs --- using System; namespace FAT.Web { public interface IPage { bool IsPostBack {get;} } } --- NEW FILE: Page.cs --- namespace FAT.Web { public class Page : IPage { private System.Web.UI.Page page; public Page(System.Web.UI.Page page) { this.page = page; } public bool IsPostBack {get {return page.IsPostBack;}} } } Index: Default.aspx =================================================================== RCS file: /cvsroot/fat/FAT/src/FAT.Web/Default.aspx,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Default.aspx 20 Feb 2004 17:56:50 -0000 1.5 --- Default.aspx 29 Feb 2004 14:59:52 -0000 1.6 *************** *** 1,4 **** - <%@ Page language="c#" Codebehind="Default.aspx.cs" AutoEventWireup="false" Inherits="FAT.Web.Default" EnableSessionState=true %> <%@ Register Tagprefix="FAT" Namespace="FAT.Web" Assembly="FAT.Web" %> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" > <HTML> --- 1,4 ---- <%@ Register Tagprefix="FAT" Namespace="FAT.Web" Assembly="FAT.Web" %> + <%@ Page language="c#" Codebehind="Default.aspx.cs" AutoEventWireup="false" Inherits="FAT.Web.Default" EnableSessionState=true %> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" > <HTML> *************** *** 12,16 **** function getSelectedFixture() { ! return document.CreateTest.fixture.options[document.CreateTest.fixture.selectedIndex].text; } </script> --- 12,16 ---- function getSelectedFixture() { ! return document.CreateTest.fixture_implementedFixturesDropDownList.options[document.CreateTest.fixture_implementedFixturesDropDownList.selectedIndex].text; } </script> *************** *** 43,47 **** </table> </td> ! <td><asp:Dropdownlist id="fixture" Runat="server" Width="500"></asp:Dropdownlist></td> <td><asp:Label id="fixtureWarning" Runat="server">*</asp:Label></td> </tr> --- 43,47 ---- </table> </td> ! <td><FAT:FixtureSpecifierControl runat="server" id="fixture" /></td> <td><asp:Label id="fixtureWarning" Runat="server">*</asp:Label></td> </tr> Index: Default.aspx.cs =================================================================== RCS file: /cvsroot/fat/FAT/src/FAT.Web/Default.aspx.cs,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Default.aspx.cs 20 Feb 2004 17:56:50 -0000 1.5 --- Default.aspx.cs 29 Feb 2004 14:59:52 -0000 1.6 *************** *** 22,40 **** protected Button run; ! protected DropDownList fixture; protected PlaceHolder results; protected ImageButton fixtureHelpImageButton; - protected System.Web.UI.WebControls.HyperLink HyperLink1; private DefaultPageModel model = new DefaultPageModel(); - private void Page_Load(object sender, System.EventArgs e) - { - if (!IsPostBack) - { - model.AddFixtureNamesToDropDownList(fixture); - } - } - private void Run_Click(object source, EventArgs args) { --- 22,31 ---- protected Button run; ! protected FixtureSpecifierControl fixture; protected PlaceHolder results; protected ImageButton fixtureHelpImageButton; private DefaultPageModel model = new DefaultPageModel(); private void Run_Click(object source, EventArgs args) { *************** *** 43,47 **** try { ! ITestResult testResult = model.Run(testName.Text, fixture.SelectedItem.Text, test.Text, setup.Text, teardown.Text); results.Controls.Add(model.CreateResultsTable(testResult, HtmlDetailsStore.Instance(new Session(Session)))); --- 34,38 ---- try { ! ITestResult testResult = model.Run(testName.Text, fixture.SelectedFixture, test.Text, setup.Text, teardown.Text); results.Controls.Add(model.CreateResultsTable(testResult, HtmlDetailsStore.Instance(new Session(Session)))); *************** *** 63,68 **** { this.run.Click += new System.EventHandler(this.Run_Click); - this.Load += new System.EventHandler(this.Page_Load); - } #endregion --- 54,57 ---- Index: DefaultPageModel.cs =================================================================== RCS file: /cvsroot/fat/FAT/src/FAT.Web/DefaultPageModel.cs,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** DefaultPageModel.cs 7 Feb 2004 18:11:32 -0000 1.7 --- DefaultPageModel.cs 29 Feb 2004 14:59:52 -0000 1.8 *************** *** 13,35 **** private ITestParser parser; private ITestRunner runner; - private ITestFixtureLoader loader; public DefaultPageModel() : this(ConfigurationFactory.Create()) { } ! public DefaultPageModel(IConfiguration configuration) : this(configuration.TestParser, IsolatedTestRunnerFactory.Create(), new TestFixtureLoader(configuration)) { } ! public DefaultPageModel(ITestParser parser, ITestRunner runner, ITestFixtureLoader loader) { this.parser = parser; this.runner = runner; - this.loader = loader; - } - - public void AddFixtureNamesToDropDownList(DropDownList fixturesList) - { - foreach (string fixture in loader.GetFixtureNames()) - { - fixturesList.Items.Add(new ListItem(fixture, fixture)); - } } --- 13,25 ---- private ITestParser parser; private ITestRunner runner; public DefaultPageModel() : this(ConfigurationFactory.Create()) { } ! public DefaultPageModel(IConfiguration configuration) : this(configuration.TestParser, IsolatedTestRunnerFactory.Create()) { } ! public DefaultPageModel(ITestParser parser, ITestRunner runner) { this.parser = parser; this.runner = runner; } Index: FAT.Web.csproj =================================================================== RCS file: /cvsroot/fat/FAT/src/FAT.Web/FAT.Web.csproj,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** FAT.Web.csproj 20 Feb 2004 17:56:50 -0000 1.6 --- FAT.Web.csproj 29 Feb 2004 14:59:52 -0000 1.7 *************** *** 127,130 **** --- 127,135 ---- /> <File + RelPath = "FixtureSpecifierControl.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File RelPath = "Global.asax" SubType = "Component" *************** *** 143,146 **** --- 148,161 ---- /> <File + RelPath = "IPage.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File + RelPath = "Page.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File RelPath = "TestFixtureHelp.aspx" SubType = "Form" Index: TestFixtureHelp.aspx.cs =================================================================== RCS file: /cvsroot/fat/FAT/src/FAT.Web/TestFixtureHelp.aspx.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** TestFixtureHelp.aspx.cs 20 Feb 2004 17:56:50 -0000 1.1 --- TestFixtureHelp.aspx.cs 29 Feb 2004 14:59:52 -0000 1.2 *************** *** 5,9 **** namespace FAT.Web { ! public class TestFixtureHelp : Page { protected System.Web.UI.WebControls.Literal help; --- 5,9 ---- namespace FAT.Web { ! public class TestFixtureHelp : System.Web.UI.Page { protected System.Web.UI.WebControls.Literal help; |