Imported Upstream version 3.6.0

Former-commit-id: da6be194a6b1221998fc28233f2503bd61dd9d14
This commit is contained in:
Jo Shields
2014-08-13 10:39:27 +01:00
commit a575963da9
50588 changed files with 8155799 additions and 0 deletions

View File

@@ -0,0 +1,41 @@
2009-07-07 Raja R Harinath <harinath@hurrynot.org>
* DataBoundControlAdapterTest.cs: Derive from
SystemWebTestShim.DataBoundControlAdapter.
* HideDisabledControlAdapterTest.cs (Render): Use
SystemWebTestShim.HideDisabledControlAdapter.
* HierarchicalDataBoundControlAdapterTest.cs: Derive from
SystemWebTestShim.HierarchicalDataBoundControlAdapter.
* MenuAdapterTest.cs: Derive from SystemWebTestShim.MenuAdapter.
* WebControlAdapterTest.cs: Derive from
SystemWebTestShim.WebControlAdapter.cs.
2009-07-06 Raja R Harinath <harinath@hurrynot.org>
* MenuAdapterTest.cs (MyMenuAdapter): Add new forwarding methods
to expose protected base methods.
2009-07-06 Raja R Harinath <harinath@hurrynot.org>
* DataBoundControlAdapterTest.cs (PerformDataBinding): Don't use
'protected internal' when overriding a method from a different assembly.
* HideDisabledControlAdapterTest.cs (RenderContents): Likewise.
* HierarchicalDataBoundControlAdapterTest.cs (PerformDataBinding):
Likewise.
* MenuAdapterTest.cs (OnInit, OnPreRender, RaisePostBackEvent)
(RenderContents): Likewise.
* WebControlAdapterTest.cs (RenderContents): Likewise.
2008-10-17 Marek Habersack <mhabersack@novell.com>
* MenuAdapterTest.cs: work around event validation failure in the
test environment.
2008-01-15 Dean Brettle <dean@brettle.com>
* MenuAdapterTest.cs: added
2008-01-13 Dean Brettle <dean@brettle.com>
* WebControlAdapterTest.cs, HierarchicalDataBoundControlAdapterTest.cs,
DataBoundControlAdapterTest.cs, HideDisabledControlAdapterTest.cs: added

View File

@@ -0,0 +1,98 @@
//
// Tests for System.Web.UI.WebControls.Adapters.DataBoundControlAdapter
//
// Author:
// Dean Brettle (dean@brettle.com)
//
// Copyright (C) 2008 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
#if NET_2_0 && !TARGET_DOTNET
using NUnit.Framework;
using System;
using System.Collections;
using System.Drawing;
using System.IO;
using System.Globalization;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.Adapters;
using System.Web.Configuration;
using MonoTests.SystemWeb.Framework;
namespace MonoTests.System.Web.UI.WebControls.Adapters
{
[TestFixture]
public class DataBoundControlAdapterTest
{
MyDataBoundControl c;
MyDataBoundControlAdapter a;
[SetUp]
public void SetUp ()
{
c = new MyDataBoundControl ();
a = new MyDataBoundControlAdapter (c);
}
[Test]
public void PerformDataBinding ()
{
ArrayList data = new ArrayList ();
a.PerformDataBinding (data);
Assert.AreEqual (data, c.data, "PerformDataBinding #1");
}
[Test]
public void Control ()
{
Assert.AreEqual (c, a.Control, "Control #1");
}
#region Support classes
class MyDataBoundControl : DataBoundControl
{
internal IEnumerable data;
protected internal override void PerformDataBinding (IEnumerable data)
{
this.data = data;
}
}
class MyDataBoundControlAdapter : SystemWebTestShim.DataBoundControlAdapter
{
internal MyDataBoundControlAdapter (DataBoundControl c) : base (c)
{
}
new internal DataBoundControl Control {
get { return base.Control; }
}
}
#endregion
}
}
#endif

View File

@@ -0,0 +1,101 @@
//
// Tests for System.Web.UI.WebControls.Adapters.HideDisabledControlAdapter
//
// Author:
// Dean Brettle (dean@brettle.com)
//
// Copyright (C) 2008 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
#if NET_2_0
using NUnit.Framework;
using System;
using System.Collections;
using System.Drawing;
using System.IO;
using System.Globalization;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.Adapters;
using System.Web.Configuration;
using MonoTests.SystemWeb.Framework;
namespace MonoTests.System.Web.UI.WebControls.Adapters
{
[TestFixture]
public class HideDisabledControlAdapterTest
{
[Test]
public void Render ()
{
WebControl parent = new MyWebControl();
MyWebControl c = new MyWebControl ();
SystemWebTestShim.HideDisabledControlAdapter a = new SystemWebTestShim.HideDisabledControlAdapter (c);
StringWriter sw;
HtmlTextWriter w;
sw = new StringWriter();
w = new HtmlTextWriter(sw);
a.Render (w);
Assert.AreEqual ("RenderBeginTag\nRenderContents\nRenderEndTag\n", sw.ToString(), "Render #1");
sw = new StringWriter();
w = new HtmlTextWriter(sw);
c.Enabled = false;
a.Render (w);
Assert.AreEqual ("", sw.ToString(), "Render #2");
sw = new StringWriter();
w = new HtmlTextWriter(sw);
parent.Enabled = false;
c.Enabled = true;
parent.Controls.Add(c);
a.Render (w);
Assert.AreEqual ("", sw.ToString(), "Render #3");
}
#region Support classes
class MyWebControl : WebControl
{
public override void RenderBeginTag (HtmlTextWriter w)
{
w.WriteLine("RenderBeginTag");
}
protected internal override void RenderContents (HtmlTextWriter w)
{
w.WriteLine("RenderContents");
}
public override void RenderEndTag (HtmlTextWriter w)
{
w.WriteLine("RenderEndTag");
}
}
#endregion
}
}
#endif

View File

@@ -0,0 +1,97 @@
//
// Tests for System.Web.UI.WebControls.Adapters.HierarchicalDataBoundControlAdapter
//
// Author:
// Dean Brettle (dean@brettle.com)
//
// Copyright (C) 2008 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
#if NET_2_0
using NUnit.Framework;
using System;
using System.Collections;
using System.Drawing;
using System.IO;
using System.Globalization;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.Adapters;
using System.Web.Configuration;
using MonoTests.SystemWeb.Framework;
namespace MonoTests.System.Web.UI.WebControls.Adapters
{
[TestFixture]
public class HierarchicalDataBoundControlAdapterTest
{
MyHierarchicalDataBoundControl c;
MyHierarchicalDataBoundControlAdapter a;
[SetUp]
public void SetUp ()
{
c = new MyHierarchicalDataBoundControl ();
a = new MyHierarchicalDataBoundControlAdapter (c);
}
[Test]
public void PerformDataBinding ()
{
a.PerformDataBinding ();
Assert.IsTrue (c.perform_data_binding_called, "PerformDataBinding #1");
}
[Test]
public void Control ()
{
Assert.AreEqual (c, a.Control, "Control #1");
}
#region Support classes
class MyHierarchicalDataBoundControl : HierarchicalDataBoundControl
{
internal bool perform_data_binding_called;
protected internal override void PerformDataBinding ()
{
perform_data_binding_called = true;
}
}
class MyHierarchicalDataBoundControlAdapter : SystemWebTestShim.HierarchicalDataBoundControlAdapter
{
internal MyHierarchicalDataBoundControlAdapter (HierarchicalDataBoundControl c) : base (c)
{
}
new internal HierarchicalDataBoundControl Control {
get { return base.Control; }
}
}
#endregion
}
}
#endif

View File

@@ -0,0 +1,221 @@
//
// Tests for System.Web.UI.WebControls.Adapters.MenuAdapter
//
// Author:
// Dean Brettle (dean@brettle.com)
//
// Copyright (C) 2008 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
#if NET_2_0
using NUnit.Framework;
using System;
using System.Collections;
using System.Drawing;
using System.IO;
using System.Globalization;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.Adapters;
using System.Web.Configuration;
using MonoTests.SystemWeb.Framework;
namespace MonoTests.System.Web.UI.WebControls.Adapters
{
[TestFixture]
public class MenuAdapterTest
{
MyMenu c;
MyMenuAdapter a;
StringWriter sw;
HtmlTextWriter w;
Page p;
EventArgs e;
[SetUp]
public void SetUp ()
{
p = new Page ();
c = new MyMenu ();
#if NET_4_0
c.RenderingMode = MenuRenderingMode.Table;
#endif
a = new MyMenuAdapter (c);
p.Controls.Add(c);
sw = new StringWriter ();
w = new HtmlTextWriter (sw);
e = new EventArgs();
}
[Test]
public void OnInit ()
{
a.OnInit (e);
Assert.IsTrue (p.RequiresControlState (c), "OnInit #1");
Assert.AreEqual (e, c.on_init_arg, "OnInit #2");
}
[Test]
public void OnPreRender ()
{
a.OnPreRender (e);
Assert.AreEqual (e, c.on_pre_render_arg, "OnPreRender #1");
}
[Test]
public void RaisePostBackEvent ()
{
((IPostBackEventHandler)a).RaisePostBackEvent ("eventArg");
Assert.AreEqual ("eventArg", c.raise_post_back_event_arg, "RaisePostBackEvent #1");
}
[Test]
public void RenderBeginTag ()
{
a.RenderBeginTag (w);
Assert.AreEqual ("RenderBeginTag\n", sw.ToString (), "RenderBeginTag #1");
}
[Test]
public void RenderContentsTag ()
{
a.RenderContents (w);
Assert.AreEqual ("RenderContents\n", sw.ToString (), "RenderContents #1");
}
[Test]
public void RenderEndTag ()
{
a.RenderEndTag (w);
Assert.AreEqual ("RenderEndTag\n", sw.ToString (), "RenderEndTag #1");
}
[Test]
public void RenderItem ()
{
MenuItem item = new MenuItem("menu item text");
// This has to stay to work around event validation errors. If it's removed,
// then RenderItem will eventually attempt to register for event validation,
// which can only be done during the Render phase.
item.NavigateUrl = "http://google.com/";
a.RenderItem (w, item, 0);
Assert.IsTrue (sw.ToString ().IndexOf("menu item text") != -1, "RenderItem #1");
}
[Test]
public void Control ()
{
Assert.AreEqual (c, a.Control, "Control #1");
}
#region Support classes
class MyMenu : Menu
{
internal EventArgs on_init_arg;
protected internal override void OnInit (EventArgs e)
{
on_init_arg = e;
base.OnInit (e);
}
internal EventArgs on_pre_render_arg;
protected internal override void OnPreRender (EventArgs e)
{
on_pre_render_arg = e;
base.OnPreRender (e);
}
internal string raise_post_back_event_arg;
protected internal override void RaisePostBackEvent (string eventArgument)
{
raise_post_back_event_arg = eventArgument;
}
public override void RenderBeginTag (HtmlTextWriter w)
{
w.WriteLine("RenderBeginTag");
}
protected internal override void RenderContents (HtmlTextWriter w)
{
w.WriteLine("RenderContents");
}
public override void RenderEndTag (HtmlTextWriter w)
{
w.WriteLine("RenderEndTag");
}
}
class MyMenuAdapter : SystemWebTestShim.MenuAdapter
{
internal MyMenuAdapter (Menu c) : base (c)
{
}
internal new void OnInit (EventArgs e)
{
base.OnInit (e);
}
internal new void OnPreRender (EventArgs e)
{
base.OnPreRender (e);
}
new internal void RenderBeginTag (HtmlTextWriter w)
{
base.RenderBeginTag (w);
}
new internal void RenderContents (HtmlTextWriter w)
{
base.RenderContents (w);
}
new internal void RenderEndTag (HtmlTextWriter w)
{
base.RenderEndTag (w);
}
new internal Menu Control {
get { return base.Control; }
}
internal new void RenderItem (HtmlTextWriter w, MenuItem mi, int i)
{
base.RenderItem (w, mi, i);
}
}
#endregion
}
}
#endif

View File

@@ -0,0 +1,168 @@
//
// Tests for System.Web.UI.WebControls.Adapters.WebControlAdapter
//
// Author:
// Dean Brettle (dean@brettle.com)
//
// Copyright (C) 2008 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
#if NET_2_0
using NUnit.Framework;
using System;
using System.Collections;
using System.Drawing;
using System.IO;
using System.Globalization;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.Adapters;
using System.Web.Configuration;
using MonoTests.SystemWeb.Framework;
namespace MonoTests.System.Web.UI.WebControls.Adapters
{
[TestFixture]
public class WebControlAdapterTest
{
MyWebControl c;
MyWebControlAdapter a;
StringWriter sw;
HtmlTextWriter w;
[SetUp]
public void SetUp ()
{
c = new MyWebControl ();
a = new MyWebControlAdapter (c);
sw = new StringWriter ();
w = new HtmlTextWriter (sw);
}
[Test]
public void RenderBeginTag ()
{
a.RenderBeginTag (w);
Assert.AreEqual ("RenderBeginTag\n", sw.ToString (), "RenderBeginTag #1");
}
[Test]
public void RenderContentsTag ()
{
a.RenderContents (w);
Assert.AreEqual ("RenderContents\n", sw.ToString (), "RenderContents #1");
}
[Test]
public void RenderEndTag ()
{
a.RenderEndTag (w);
Assert.AreEqual ("RenderEndTag\n", sw.ToString (), "RenderEndTag #1");
}
[Test]
public void Render ()
{
a.Render (w);
Assert.AreEqual ("RenderBeginTag\nRenderContents\nRenderEndTag\n", sw.ToString (), "Render #1");
}
[Test]
public void Control ()
{
Assert.AreEqual (c, a.Control, "Control #1");
}
[Test]
public void IsEnabled ()
{
MyWebControl parent = new MyWebControl ();
parent.Controls.Add (c);
Assert.IsTrue (a.IsEnabled, "IsEnabled #1");
parent.Enabled = false;
Assert.IsFalse (a.IsEnabled, "IsEnabled #2");
parent.Enabled = true;
c.Enabled = false;
Assert.IsFalse (a.IsEnabled, "IsEnabled #3");
}
#region Support classes
class MyWebControl : WebControl
{
public override void RenderBeginTag (HtmlTextWriter w)
{
w.WriteLine("RenderBeginTag");
}
protected internal override void RenderContents (HtmlTextWriter w)
{
w.WriteLine("RenderContents");
}
public override void RenderEndTag (HtmlTextWriter w)
{
w.WriteLine("RenderEndTag");
}
}
class MyWebControlAdapter : SystemWebTestShim.WebControlAdapter
{
internal MyWebControlAdapter (WebControl wc) : base (wc)
{
}
new internal void RenderBeginTag (HtmlTextWriter w)
{
base.RenderBeginTag(w);
}
new internal void RenderContents (HtmlTextWriter w)
{
base.RenderContents(w);
}
new internal void RenderEndTag (HtmlTextWriter w)
{
base.RenderEndTag(w);
}
new internal void Render (HtmlTextWriter w)
{
base.Render(w);
}
new internal WebControl Control {
get { return base.Control; }
}
new internal bool IsEnabled {
get { return base.IsEnabled; }
}
}
#endregion
}
}
#endif