Cleanup the ondotnet target of the System.Web 2.0 test suite (0 failures), making it an efficient reference point for new tests verification.
svn path=/trunk/mcs/; revision=67439
[TestFixture]
public class ApplicationHostTest {
- [SetUp] public void Setup ()
+ [SetUp]
+ public void Setup ()
{
try {
//
ApplicationHost.CreateApplicationHost (null, null, null);
}
- [Test][ExpectedException (typeof (UriFormatException))]
+ [Test]
+ [Category ("NotWorking")]
+ [ExpectedException (typeof (ArgumentException))]
public void ConstructorTestNull2 ()
{
//
ApplicationHost.CreateApplicationHost (null, "/app", ".");
}
- [Test][ExpectedException (typeof (UriFormatException))]
+ [Test]
+ [Category("NotWorking")]
+ [ExpectedException (typeof (ArgumentNullException))]
public void ConstructorTestNull3 ()
{
//
public void FileExists1 ()
{
DummyVPP dummy = new DummyVPP ();
- Assert.IsNull (dummy.FileExists ("hola.aspx"));
+ Assert.IsFalse (dummy.FileExists ("hola.aspx"));
}
[Test]
public void DirectoryExists1 ()
{
DummyVPP dummy = new DummyVPP ();
- Assert.IsNull (dummy.DirectoryExists ("hola"));
+ Assert.IsFalse (dummy.DirectoryExists ("hola"));
}
[Test]
ProfileInfoPoker poker = new ProfileInfoPoker();
Assert.IsNull (poker.UserName, "A1");
- Assert.AreEqual (DateTime.MinValue, poker.LastUpdatedDate, "A2");
- Assert.AreEqual (DateTime.MinValue, poker.LastActivityDate, "A3");
+ Assert.AreEqual (DateTime.MinValue, poker.LastUpdatedDate.Date, "A2");
+ Assert.AreEqual (DateTime.MinValue, poker.LastActivityDate.Date, "A3");
Assert.IsFalse (poker.IsAnonymous, "A4");
Assert.AreEqual (0, poker.Size, "A5");
}
using System.Web;
using System.Web.UI;
using System.Web.UI.HtmlControls;
-
+using MonoTests.stand_alone.WebHarness;
using NUnit.Framework;
namespace MonoTests.System.Web.UI.HtmlControls {
FormPoker form = new FormPoker ();
form.Page = p;
#if NET_2_0
- Assert.AreEqual ("<div>\r\n<input type=\"hidden\" name=\"__VIEWSTATE\" id=\"\r\n__VIEWSTATE\" value=\"\" />\r\n</div>", form.RenderChildren ().Trim (), "A1");
+ HtmlDiff.AssertAreEqual ("<div>\r\n<input type=\"hidden\" name=\"__VIEWSTATE\" id=\"\r\n__VIEWSTATE\" value=\"\" />\r\n</div>", form.RenderChildren ().Trim (), "A1");
#else
- Assert.AreEqual ("<input type=\"hidden\" name=\"__VIEWSTATE\" value=\"\" />", form.RenderChildren ().Trim (), "A1");
+ HtmlDiff.AssertAreEqual ("<input type=\"hidden\" name=\"__VIEWSTATE\" value=\"\" />", form.RenderChildren ().Trim (), "A1");
#endif
}
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
-
+using MonoTests.stand_alone.WebHarness;
using NUnit.Framework;
namespace MonoTests.System.Web.UI.HtmlControls {
p.DoRenderAttributes (tw);
#if NET_2_0
- Assert.AreEqual (" name type=\"button\" ValidationGroup=\"VG\" /", sw.ToString (), "A2");
+ HtmlDiff.AssertAreEqual (" name type=\"button\" ValidationGroup=\"VG\" /", sw.ToString (), "A2");
#else
- Assert.AreEqual (" name type=\"button\" /", sw.ToString (), "A2");
+ HtmlDiff.AssertAreEqual (" name type=\"button\" /", sw.ToString (), "A2");
#endif
}
public void RenderOnclick2 ()
{
Page page = new Page ();
+ page.EnableEventValidation = false;
HtmlInputButtonPoker it = new HtmlInputButtonPoker ("button");
page.Controls.Add (it);
it.ID = "id1";
}
[Test]
- [Category ("NotWorking")]
+ [Category ("NotWorking")]
public void RenderOnclick4 ()
{
Page page = new Page ();
+ page.EnableEventValidation = false;
HtmlInputButtonPoker it = new HtmlInputButtonPoker ("submit");
page.Controls.Add (it);
it.ID = "id1";
it.ServerClick += new EventHandler (EmptyHandler);
string rendered = it.RenderToString ();
- Assert.IsTrue (rendered.IndexOf ("onclick") == -1, "#01");
+ Assert.IsTrue (rendered.IndexOf ("onclick") != -1, "#01");
+ Assert.IsTrue (rendered.IndexOf ("__doPostBack") != -1, "#02");
+ Assert.IsTrue (rendered.IndexOf ("type=\"submit\"") != -1, "#03");
}
[Test]
public void RenderOnclick5 ()
{
Page page = new Page ();
+ page.EnableEventValidation = false;
RequiredFieldValidator val = new RequiredFieldValidator ();
val.ControlToValidate = "id1";
page.Validators.Add (val);
using System.IO;
using System.Web.UI;
using System.Web.UI.HtmlControls;
-
+using MonoTests.stand_alone.WebHarness;
using NUnit.Framework;
namespace MonoTests.System.Web.UI.HtmlControls {
Assert.AreEqual (1, c.Attributes.Count, "Attributes.Count after");
}
- [Test]
+ [Test]
public void Render ()
{
TestHtmlInputCheckBox c = new TestHtmlInputCheckBox ();
s = c.Render ();
#if NET_2_0
- Assert.AreEqual ("<input name=\"*1*\" type=\"checkbox\" id=\"*1*\" checked=\"checked\" />", s);
+ HtmlDiff.AssertAreEqual ("<input name=\"*1*\" id=\"*1*\" type=\"checkbox\" checked=\"checked\" />", s, "Render fail");
#else
- Assert.AreEqual ("<input name=\"*1*\" id=\"*1*\" type=\"checkbox\" checked=\"checked\" />", s);
+ HtmlDiff.AssertAreEqual ("<input name=\"*1*\" type=\"checkbox\" id=\"*1*\" checked=\"checked\" />", s, "Render fail");
#endif
}
}
using System.IO;
using System.Web.UI;
using System.Web.UI.HtmlControls;
-
+using MonoTests.stand_alone.WebHarness;
using NUnit.Framework;
namespace MonoTests.System.Web.UI.HtmlControls {
ic.Name = "mono";
ic.Value = "value";
- Assert.AreEqual (" name type=\"test\" value=\"value\" /", ic.RenderAttributes ());
+ HtmlDiff.AssertAreEqual (" name type=\"test\" value=\"value\" /", ic.RenderAttributes (), "RenderAttributes failed #1");
ic.ID = "toto";
#if NET_2_0
- Assert.AreEqual (" name=\"toto\" type=\"test\" id=\"toto\" value=\"value\" /", ic.RenderAttributes ());
+ HtmlDiff.AssertAreEqual (" name=\"toto\" id=\"toto\" type=\"test\" value=\"value\" /", ic.RenderAttributes (), "RenderAttributes failed #2");
#else
- Assert.AreEqual (" name=\"toto\" id=\"toto\" type=\"test\" value=\"value\" /", ic.RenderAttributes ());
+ HtmlDiff.AssertAreEqual(" name=\"toto\" id=\"toto\" type=\"test\" value=\"value\" /", ic.RenderAttributes() , "RenderAttributes failed #3");
#endif
}
ic.Value = "s3kr3t";
// logic to hide password isn't in HtmlInputControl
- Assert.AreEqual (" name type=\"password\" value=\"s3kr3t\" /", ic.RenderAttributes ());
+ HtmlDiff.AssertAreEqual (" name type=\"password\" value=\"s3kr3t\" /", ic.RenderAttributes (), "Password failed");
}
}
}
using System.IO;
using System.Web.UI;
using System.Web.UI.HtmlControls;
-
+using MonoTests.stand_alone.WebHarness;
using NUnit.Framework;
namespace MonoTests.System.Web.UI.HtmlControls {
#if NET_2_0
public bool LoadPost (string key, NameValueCollection nvc)
{
- return base.LoadPostData (key, nvc);
+ return base.LoadPostData(key, nvc);
}
public void Raise ()
it.Value = "s3kr3t";
#if NET_2_0
// value is there, maybe because a new HtmlInputPassword class exists ?
- Assert.AreEqual (" name=\"mono\" type=\"password\" id=\"mono\" maxlength=\"2\" size=\"4\" value=\"s3kr3t\" /", it.RenderAttributes ());
+ HtmlDiff.AssertAreEqual (" name=\"mono\" id=\"mono\" type=\"password\" maxlength=\"2\" size=\"4\" value=\"s3kr3t\" /", it.RenderAttributes (),"Render failed");
Assert.IsFalse (it.ViewStateValueChanged, "ViewStateValueChanged");
Assert.IsFalse (it.AttributeValueChanged, "AttributeValueChanged");
#else
- Assert.AreEqual (" name=\"mono\" id=\"mono\" type=\"password\" maxlength=\"2\" size=\"4\" /", it.RenderAttributes ());
+ HtmlDiff.AssertAreEqual(" name=\"mono\" id=\"mono\" type=\"password\" maxlength=\"2\" size=\"4\" /", it.RenderAttributes(),"Render failed");
Assert.IsTrue (it.ViewStateValueChanged, "ViewStateValueChanged");
Assert.IsTrue (it.AttributeValueChanged, "AttributeValueChanged");
#endif
#if NET_2_0
-using NUnit.Framework;
-
+using NUnit.Framework;\r
+using MonoTests.stand_alone.WebHarness;
using System;
using System.IO;
using System.Web.UI;
meta.Content = "Content";
meta.HttpEquiv = "Equiv";
meta.Scheme = "Scheme";
- Assert.AreEqual ("<meta name=\"Name\" content=\"Content\" http-equiv=\"Equiv\" scheme=\"Scheme\" />", meta.Render(), "A1");
+ HtmlDiff.AssertAreEqual ("<meta name=\"Name\" content=\"Content\" http-equiv=\"Equiv\" scheme=\"Scheme\" />", meta.Render(), "A1");
}
[Test]
}
}
-#endif
+#endif\r
ta.Name = "mono";
ta.Value = "value";
// value is out
- Assert.AreEqual (" name cols=\"4\" rows=\"2\"", ta.RenderAttributes ());
+ HtmlDiff.AssertAreEqual (" name cols=\"4\" rows=\"2\"", ta.RenderAttributes (),"RenderAttributes failed #1");
ta.ID = "go";
- Assert.AreEqual (" name=\"go\" id=\"go\" cols=\"4\" rows=\"2\"", ta.RenderAttributes ());
+ HtmlDiff.AssertAreEqual (" name=\"go\" id=\"go\" cols=\"4\" rows=\"2\"", ta.RenderAttributes (),"RenderAttributes failed #2");
}
[Test]
ta.Name = "mono";
ta.Value = "value";
// value is out
- Assert.AreEqual ("<textarea name cols=\"4\" rows=\"2\">value</textarea>", ta.Render ());
+ HtmlDiff.AssertAreEqual ("<textarea name cols=\"4\" rows=\"2\">value</textarea>", ta.Render (),"Render #1");
ta.ID = "go";
- Assert.AreEqual ("<textarea name=\"go\" id=\"go\" cols=\"4\" rows=\"2\">value</textarea>", ta.Render ());
+ HtmlDiff.AssertAreEqual ("<textarea name=\"go\" id=\"go\" cols=\"4\" rows=\"2\">value</textarea>", ta.Render (),"Render #2");
}
[Test]
Assert.AreEqual ("", sql.CacheKeyDependency, "A1");
Assert.IsTrue (sql.CancelSelectOnNullParameter, "A2");
Assert.AreEqual (ConflictOptions.OverwriteChanges, sql.ConflictDetection, "A3");
- Assert.AreEqual (SqlDataSourceCommandType.StoredProcedure, sql.DeleteCommandType, "A4");
- Assert.AreEqual (SqlDataSourceCommandType.StoredProcedure, sql.InsertCommandType, "A5");
- Assert.AreEqual (SqlDataSourceCommandType.StoredProcedure, sql.SelectCommandType, "A6");
- Assert.AreEqual (SqlDataSourceCommandType.StoredProcedure, sql.UpdateCommandType, "A7");
+ Assert.AreEqual(SqlDataSourceCommandType.Text, sql.DeleteCommandType, "A4");
+ Assert.AreEqual(SqlDataSourceCommandType.Text, sql.InsertCommandType, "A5");
+ Assert.AreEqual(SqlDataSourceCommandType.Text, sql.SelectCommandType, "A6");
+ Assert.AreEqual(SqlDataSourceCommandType.Text, sql.UpdateCommandType, "A7");
Assert.AreEqual ("{0}", sql.OldValuesParameterFormatString, "A8");
// SqlCacheDependency access should raise an exception
Assert.AreEqual ("", sql.FilterExpression, "A26");
Assert.AreEqual ("", sql.DataFile, "A27");
}
- }
-
+ }
}
#endif
using System.Web;
using System.Web.UI;
using System.Globalization;
+using System.Threading;
class PokerCalendar : System.Web.UI.WebControls.Calendar {
public PokerCalendar ()
}
[Test]
+ [Category ("NotWorking")]
public void SelectDateProperty ()
{
PokerCalendar c = new PokerCalendar ();
Assert.AreEqual (today, c.SelectedDate, "SelectDateProperty #1");
c.SelectedDate = now;
- Assert.AreEqual (today, c.SelectedDate, "SelectDateProperty #2");
+ Assert.AreEqual (now, c.SelectedDate, "SelectDateProperty #2");
}
[Test]
[Test]
public void TestRenderMonthStartsOnSunday ()
{
+ Thread.CurrentThread.CurrentCulture = new CultureInfo ("en-US", false);
PokerCalendar p = new PokerCalendar ();
p.TodaysDate = new DateTime (2005, 5, 14);
*/
[Test]
+ [Category ("NotWorking")]
public void HaveBaseAttributes ()
{
PokerCalendar p = new PokerCalendar ();
p.TodaysDate = new DateTime (2005, 8, 4);
p.SelectedDate = p.TodaysDate;
string s = p.Render();
- Assert.IsTrue (s.IndexOf ("adios") != -11, "#01");
- Assert.IsTrue (p.CS_Called == false, "#01");
+ Assert.IsTrue (s.IndexOf ("adios") != -1, "#01");
+ Assert.IsTrue (p.CS_Called == true, "#02");
}
}
}
HtmlTextWriter tw = new HtmlTextWriter (sw);
Page page = new Page ();
+ page.EnableEventValidation = false;
ImageButton b = new ImageButton ();
page.Controls.Add (b);
page.RenderControl (tw);
namespace MonoTests.System.Web.UI.WebControls {
- public class LoginTemplate : WebControl, ITemplate {
+ public class LoginTemplate :WebControl, ITemplate {
public LoginTemplate() {
ID = "kuku";
- }
-
- void ITemplate.InstantiateIn(Control container) {
+ }
+ void ITemplate.InstantiateIn(Control container) {
container.Controls.Add(this);
}
-
- }
-
- public class TestLogin : Login {
+ }
+
+ public class LayoutTemplate :WebControl, ITemplate
+ {
+ TextBox user;
+ TextBox pass;
+ CheckBox remme;
+ Button login;
+ Literal failure;
+
+ public LayoutTemplate(){
+ Buildcontrols();
+ Addtocontainer();
+ }
+
+ #region build
+ public void Buildcontrols()
+ {
+ user = new TextBox();
+ pass = new TextBox();
+ remme = new CheckBox();
+ login = new Button();
+ failure = new Literal();
+
+ ID = "Template";
+ user.ID = "UserName";
+ pass.ID = "Password";
+ remme.ID = "RememberMe";
+ login.ID = "Login";
+ failure.ID = "FailureText";
+ }
+
+ public void Addtocontainer()
+ {
+ this.Controls.Add(user);
+ this.Controls.Add(pass);
+ this.Controls.Add(remme);
+ this.Controls.Add(login);
+ this.Controls.Add(failure);
+ }
+ #endregion
+
+ void ITemplate.InstantiateIn(Control container)
+ {
+ container.Controls.Add(this);
+ }
+ }
+
+ public class TestLogin : Login {
public string Tag {
get { return base.TagName; }
TestLogin l = new TestLogin ();
l.FailureAction = (LoginFailureAction) Int32.MinValue;
}
-
+
+ [Test]
+ public void LayoutTemplate()
+ {
+ TestLogin l = new TestLogin();
+ l.LayoutTemplate = new LayoutTemplate();
+ l.DoEnsureChildControls();
+ Assert.IsNotNull(l.FindControl("Template"), "LoginTemplate");
+ Assert.IsNotNull(l.FindControl("UserName"), "UserName");
+ }
+
+
[Test]
- public void LayoutTemplate ()
+ [Category ("NotWorking")]
+ [ExpectedException(typeof(HttpException))]
+ public void LayoutTemplateException ()
{
TestLogin l = new TestLogin ();
l.LayoutTemplate = new LoginTemplate();
l.DoEnsureChildControls();
- Assert.IsNotNull(l.FindControl("kuku"), "LoginTemplate");
}
[Test]
TestRadioButton b2 = new TestRadioButton ();
b2.GroupName = "mono";
Page p = new Page ();
+ p.EnableEventValidation = false;
p.ID = "MyPage";
p.Controls.Add (b1);
p.Controls.Add (b2);
Assert.AreEqual ("", sql.CacheKeyDependency, "A1");
Assert.IsTrue (sql.CancelSelectOnNullParameter, "A2");
- Assert.AreEqual (ConflictOptions.OverwriteChanges, sql.ConflictDetection, "A3");
- Assert.AreEqual (SqlDataSourceCommandType.StoredProcedure, sql.DeleteCommandType, "A4");
- Assert.AreEqual (SqlDataSourceCommandType.StoredProcedure, sql.InsertCommandType, "A5");
- Assert.AreEqual (SqlDataSourceCommandType.StoredProcedure, sql.SelectCommandType, "A6");
- Assert.AreEqual (SqlDataSourceCommandType.StoredProcedure, sql.UpdateCommandType, "A7");
+ Assert.AreEqual(ConflictOptions.OverwriteChanges, sql.ConflictDetection, "A3");
+ Assert.AreEqual(SqlDataSourceCommandType.Text, sql.DeleteCommandType, "A4");
+ Assert.AreEqual(SqlDataSourceCommandType.Text, sql.InsertCommandType, "A5");
+ Assert.AreEqual(SqlDataSourceCommandType.Text, sql.SelectCommandType, "A6");
+ Assert.AreEqual(SqlDataSourceCommandType.Text, sql.UpdateCommandType, "A7");
Assert.AreEqual ("{0}", sql.OldValuesParameterFormatString, "A8");
Assert.AreEqual ("", sql.SqlCacheDependency, "A9");
Assert.AreEqual ("", sql.SortParameterName, "A10");
[Test]
[Category ("NotWorking")]
- public void ViewState ()
+ public void ViewState ()
{
SqlPoker sql = new SqlPoker ();
sql.CacheKeyDependency = "hi";
sql.CancelSelectOnNullParameter = false;
sql.ConflictDetection = ConflictOptions.CompareAllValues;
- sql.DeleteCommandType = SqlDataSourceCommandType.Text;
- sql.InsertCommandType = SqlDataSourceCommandType.Text;
- sql.SelectCommandType = SqlDataSourceCommandType.Text;
- sql.UpdateCommandType = SqlDataSourceCommandType.Text;
+ sql.DeleteCommandType = SqlDataSourceCommandType.StoredProcedure;
+ sql.InsertCommandType = SqlDataSourceCommandType.StoredProcedure;
+ sql.SelectCommandType = SqlDataSourceCommandType.StoredProcedure;
+ sql.UpdateCommandType = SqlDataSourceCommandType.StoredProcedure;
sql.OldValuesParameterFormatString = "{1}";
sql.SqlCacheDependency = "hi";
sql.SortParameterName = "hi";
Assert.AreEqual ("hi", sql.CacheKeyDependency, "A1");
Assert.IsFalse (sql.CancelSelectOnNullParameter, "A2");
Assert.AreEqual (ConflictOptions.CompareAllValues, sql.ConflictDetection, "A3");
- Assert.AreEqual (SqlDataSourceCommandType.Text, sql.DeleteCommandType, "A4");
- Assert.AreEqual (SqlDataSourceCommandType.Text, sql.InsertCommandType, "A5");
- Assert.AreEqual (SqlDataSourceCommandType.Text, sql.SelectCommandType, "A6");
- Assert.AreEqual (SqlDataSourceCommandType.Text, sql.UpdateCommandType, "A7");
+ Assert.AreEqual(SqlDataSourceCommandType.StoredProcedure, sql.DeleteCommandType, "A4");
+ Assert.AreEqual(SqlDataSourceCommandType.StoredProcedure, sql.InsertCommandType, "A5");
+ Assert.AreEqual(SqlDataSourceCommandType.StoredProcedure, sql.SelectCommandType, "A6");
+ Assert.AreEqual(SqlDataSourceCommandType.StoredProcedure, sql.UpdateCommandType, "A7");
Assert.AreEqual ("{1}", sql.OldValuesParameterFormatString, "A8");
Assert.AreEqual ("hi", sql.SqlCacheDependency, "A9");
Assert.AreEqual ("hi", sql.SortParameterName, "A10");
sql = new SqlPoker ();
sql.LoadFromViewState (state);
- Assert.AreEqual ("hi", sql.CacheKeyDependency, "B1");
- Assert.IsFalse (sql.CancelSelectOnNullParameter, "B2");
- Assert.AreEqual (ConflictOptions.CompareAllValues, sql.ConflictDetection, "B3");
- Assert.AreEqual (SqlDataSourceCommandType.Text, sql.DeleteCommandType, "B4");
- Assert.AreEqual (SqlDataSourceCommandType.Text, sql.InsertCommandType, "B5");
- Assert.AreEqual (SqlDataSourceCommandType.Text, sql.SelectCommandType, "B6");
- Assert.AreEqual (SqlDataSourceCommandType.Text, sql.UpdateCommandType, "B7");
- Assert.AreEqual ("{1}", sql.OldValuesParameterFormatString, "B8");
- Assert.AreEqual ("hi", sql.SqlCacheDependency, "B9");
- Assert.AreEqual ("hi", sql.SortParameterName, "B10");
- Assert.AreEqual (1, sql.CacheDuration, "B11");
- Assert.AreEqual (DataSourceCacheExpiry.Sliding, sql.CacheExpirationPolicy, "B12");
- Assert.IsTrue (sql.EnableCaching, "B13");
- Assert.AreEqual (SqlDataSourceMode.DataReader, sql.DataSourceMode, "B16");
- Assert.AreEqual ("DELETE foo", sql.DeleteCommand, "B17");
- Assert.AreEqual ("INSERT foo", sql.InsertCommand, "B20");
- Assert.AreEqual ("SELECT foo", sql.SelectCommand, "B22");
- Assert.AreEqual ("UPDATE foo", sql.UpdateCommand, "B24");
- Assert.AreEqual ("hi", sql.FilterExpression, "B26");
- }
- }
-
+ Assert.AreEqual("", sql.CacheKeyDependency, "B1");
+ Assert.IsTrue(sql.CancelSelectOnNullParameter, "B2");
+ Assert.AreEqual(ConflictOptions.OverwriteChanges, sql.ConflictDetection, "B3");
+ Assert.AreEqual(SqlDataSourceCommandType.Text, sql.DeleteCommandType, "B4");
+ Assert.AreEqual(SqlDataSourceCommandType.Text, sql.InsertCommandType, "B5");
+ Assert.AreEqual(SqlDataSourceCommandType.Text, sql.SelectCommandType, "B6");
+ Assert.AreEqual(SqlDataSourceCommandType.Text, sql.UpdateCommandType, "B7");
+ Assert.AreEqual("{0}", sql.OldValuesParameterFormatString, "B8");
+ Assert.AreEqual("", sql.SqlCacheDependency, "B9");
+ Assert.AreEqual("", sql.SortParameterName, "B10");
+ Assert.AreEqual(0, sql.CacheDuration, "B11");
+ Assert.AreEqual(DataSourceCacheExpiry.Absolute, sql.CacheExpirationPolicy, "B12");
+ Assert.IsFalse(sql.EnableCaching, "B13");
+ Assert.AreEqual("", sql.ProviderName, "B14");
+ Assert.AreEqual("", sql.ConnectionString, "B15");
+ Assert.AreEqual(SqlDataSourceMode.DataSet, sql.DataSourceMode, "B16");
+ Assert.AreEqual("", sql.DeleteCommand, "B17");
+ Assert.IsNotNull(sql.DeleteParameters, "B18");
+ Assert.AreEqual(0, sql.DeleteParameters.Count, "B18.1");
+ Assert.IsNotNull(sql.FilterParameters, "B19");
+ Assert.AreEqual(0, sql.FilterParameters.Count, "B19.1");
+ Assert.AreEqual("", sql.InsertCommand, "B20");
+ Assert.IsNotNull(sql.InsertParameters, "B21");
+ Assert.AreEqual(0, sql.InsertParameters.Count, "B21.1");
+ Assert.AreEqual("", sql.SelectCommand, "B22");
+ Assert.IsNotNull(sql.SelectParameters, "B23");
+ Assert.AreEqual(0, sql.SelectParameters.Count, "B23.1");
+ Assert.AreEqual("", sql.UpdateCommand, "B24");
+ Assert.IsNotNull(sql.UpdateParameters, "B25");
+ Assert.AreEqual(0, sql.UpdateParameters.Count, "B25.1");
+ Assert.AreEqual("", sql.FilterExpression, "B26");
+ }
+ }
}
#endif
Assert.IsFalse (sql.CanUpdate,"A7");
Assert.AreEqual (ConflictOptions.OverwriteChanges, sql.ConflictDetection, "A8");
Assert.AreEqual ("", sql.DeleteCommand, "A9");
- Assert.AreEqual (SqlDataSourceCommandType.StoredProcedure, sql.DeleteCommandType, "A10");
+ Assert.AreEqual (SqlDataSourceCommandType.Text, sql.DeleteCommandType, "A10");
Assert.IsNotNull (sql.DeleteParameters, "A11");
Assert.AreEqual (0, sql.DeleteParameters.Count, "A12");
Assert.AreEqual ("", sql.FilterExpression, "A13");
Assert.IsNotNull (sql.FilterParameters, "A14");
Assert.AreEqual (0, sql.FilterParameters.Count, "A15");
Assert.AreEqual ("", sql.InsertCommand, "A16");
- Assert.AreEqual (SqlDataSourceCommandType.StoredProcedure, sql.InsertCommandType, "A17");
+ Assert.AreEqual (SqlDataSourceCommandType.Text, sql.InsertCommandType, "A17");
Assert.IsNotNull (sql.InsertParameters, "A18");
Assert.AreEqual (0, sql.InsertParameters.Count, "A19");
Assert.AreEqual ("{0}", sql.OldValuesParameterFormatString, "A20");
Assert.AreEqual ("", sql.SelectCommand, "A21");
- Assert.AreEqual (SqlDataSourceCommandType.StoredProcedure, sql.SelectCommandType, "A22");
+ Assert.AreEqual (SqlDataSourceCommandType.Text, sql.SelectCommandType, "A22");
Assert.IsNotNull (sql.SelectParameters, "A23");
Assert.AreEqual (0, sql.SelectParameters.Count, "A24");
Assert.AreEqual ("", sql.SortParameterName, "A25");
Assert.AreEqual ("", sql.UpdateCommand, "A26");
- Assert.AreEqual (SqlDataSourceCommandType.StoredProcedure, sql.UpdateCommandType, "A27");
+ Assert.AreEqual (SqlDataSourceCommandType.Text, sql.UpdateCommandType, "A27");
Assert.IsNotNull (sql.UpdateParameters, "A28");
Assert.AreEqual (0, sql.UpdateParameters.Count, "A29");
}
[Test]
- [Category ("NotWorking")]
- public void ViewState ()
+ [Category ("NotWorking")]
+ public void ViewState ()
{
SqlDataSource ds = new SqlDataSource ();
SqlViewPoker sql = new SqlViewPoker (ds, "DefaultView", null);
sql = new SqlViewPoker (ds, "DefaultView", null);
sql.LoadFromViewState (state);
- Assert.IsFalse (sql.CancelSelectOnNullParameter, "B1");
- Assert.AreEqual (ConflictOptions.CompareAllValues, sql.ConflictDetection, "B2");
- Assert.AreEqual ("delete command", sql.DeleteCommand, "B3");
- Assert.AreEqual (SqlDataSourceCommandType.Text, sql.DeleteCommandType, "B4");
- Assert.AreEqual ("filter expression", sql.FilterExpression, "B5");
- Assert.AreEqual ("insert command", sql.InsertCommand, "B6");
- Assert.AreEqual (SqlDataSourceCommandType.Text, sql.InsertCommandType, "B7");
- Assert.AreEqual ("{1}", sql.OldValuesParameterFormatString, "B8");
- Assert.AreEqual ("select command", sql.SelectCommand, "B9");
- Assert.AreEqual (SqlDataSourceCommandType.Text, sql.SelectCommandType, "B10");
- Assert.AreEqual ("sort parameter", sql.SortParameterName, "B11");
- Assert.AreEqual ("update command", sql.UpdateCommand, "B12");
- Assert.AreEqual (SqlDataSourceCommandType.Text, sql.UpdateCommandType, "B13");
+ Assert.IsTrue(sql.CancelSelectOnNullParameter, "B1");
+ Assert.IsFalse(sql.CanDelete, "B2");
+ Assert.IsFalse(sql.CanInsert, "B3");
+ Assert.IsFalse(sql.CanPage, "B4");
+ Assert.IsFalse(sql.CanRetrieveTotalRowCount, "B5");
+ Assert.IsTrue(sql.CanSort, "B6");
+ Assert.IsFalse(sql.CanUpdate, "B7");
+ Assert.AreEqual(ConflictOptions.OverwriteChanges, sql.ConflictDetection, "B8");
+ Assert.AreEqual("", sql.DeleteCommand, "B9");
+ Assert.AreEqual(SqlDataSourceCommandType.Text, sql.DeleteCommandType, "B10");
+ Assert.IsNotNull(sql.DeleteParameters, "B11");
+ Assert.AreEqual(0, sql.DeleteParameters.Count, "B12");
+ Assert.AreEqual("", sql.FilterExpression, "B13");
+ Assert.IsNotNull(sql.FilterParameters, "B14");
+ Assert.AreEqual(0, sql.FilterParameters.Count, "B15");
+ Assert.AreEqual("", sql.InsertCommand, "B16");
+ Assert.AreEqual(SqlDataSourceCommandType.Text, sql.InsertCommandType, "B17");
+ Assert.IsNotNull(sql.InsertParameters, "B18");
+ Assert.AreEqual(0, sql.InsertParameters.Count, "B19");
+ Assert.AreEqual("{0}", sql.OldValuesParameterFormatString, "B20");
+ Assert.AreEqual("", sql.SelectCommand, "B21");
+ Assert.AreEqual(SqlDataSourceCommandType.Text, sql.SelectCommandType, "B22");
+ Assert.IsNotNull(sql.SelectParameters, "B23");
+ Assert.AreEqual(0, sql.SelectParameters.Count, "B24");
+ Assert.AreEqual("", sql.SortParameterName, "B25");
+ Assert.AreEqual("", sql.UpdateCommand, "B26");
+ Assert.AreEqual(SqlDataSourceCommandType.Text, sql.UpdateCommandType, "B27");
+ Assert.IsNotNull(sql.UpdateParameters, "B28");
+ Assert.AreEqual(0, sql.UpdateParameters.Count, "B29");
}
[Test]
}
[Test]
- [ExpectedException (typeof (NullReferenceException))]
- public void InitialNoBag10 ()
+ [Category("NotWorking")]
+ public void InitialNoBag10()
{
- AC ac = new AC (null);
- CssStyleCollection css = ac.CssStyle;
- int i = css.Count;
+ AC ac = new AC(null);
+ CssStyleCollection css = ac.CssStyle;
+ int i = css.Count;
+ Assert.AreEqual(0, i, "InitialNoBag10");
}
[Test]
- [ExpectedException (typeof (NullReferenceException))]
- public void InitialNoBag11 ()
+ [Category("NotWorking")]
+ public void InitialNoBag11()
{
- AC ac = new AC (null);
- CssStyleCollection css = ac.CssStyle;
- ICollection coll = css.Keys;
+ AC ac = new AC(null);
+ CssStyleCollection css = ac.CssStyle;
+ ICollection coll = css.Keys;
+ Assert.AreEqual(0, coll.Count, "InitialNoBag11");
}
[Test]
- [ExpectedException (typeof (NullReferenceException))]
- public void InitialNoBag12 ()
+ [Category("NotWorking")]
+ public void InitialNoBag12()
{
- AC ac = new AC (null);
- CssStyleCollection css = ac.CssStyle;
- string v = css ["hola"];
+ AC ac = new AC(null);
+ CssStyleCollection css = ac.CssStyle;
+ string v = css["hola"];
+ Assert.AreEqual(null, v, "InitialNoBag12");
}
-
+
[Test]
public void InitialBag1 ()
{
}
[Test]
- [Category ("NotWorking")]
+ [Category ("NotWorking")]
public void IsViewStateEnabled ()
{
DerivedControl c = new DerivedControl ();
- Assert.IsFalse (c.DoIsViewStateEnabled);
+ Assert.IsTrue (c.DoIsViewStateEnabled);
Page p = new Page ();
c.Page = p;
p.Controls.Add (c);
using System.Diagnostics;
using MonoTests.SystemWeb.Framework;
using System.IO;
+using System.Threading;
+using System.Globalization;
namespace MonoTests.System.Web {
[Test]
public void Test_QueryStringDecoding()
{
+ // Note: The string to encode must exist in default encoding language
+ // \r - will exist in all encodings
string url = "http://www.gnome.org/";
- string qs = "umlaut=" + HttpUtility.UrlEncode("\u00e4", Encoding.Default);
+ string qs = "umlaut=" + HttpUtility.UrlEncode("\r", Encoding.Default);
HttpRequest r = new HttpRequest ("file", url, qs);
- Assert.AreEqual("\u00e4", r.QueryString["umlaut"]);
+ Assert.AreEqual ("\r", r.QueryString["umlaut"]);
}
[Test]
public class SiteMapNodeTest
{
[Test]
- [Category ("NotWorking")]
+ [Category ("NotWorking")]
public void Node_Null_Attrib_equals ()
{
+ // Note: dot.net implementation dosn't compare attributes
SiteMapNode node = new SiteMapNode (new DummyProvider (), "", "", "", null, null, null, null, null);
SiteMapNode node1 = new SiteMapNode (new DummyProvider (), "", "", "", null, null, null, null, null);
SiteMapNode node2 = new SiteMapNode (new DummyProvider (), "", "", "", null, null, new NameValueCollection (), null, null);
Assert.IsTrue (node.Equals (node1), "both nodes have attrib=null");
+ Assert.IsTrue (node.Equals (node2), "one node has attrib=null");
+ }
+
+ [Test]
+ public void Node_equals ()
+ {
+ SiteMapNode node = new SiteMapNode (new DummyProvider (), "Node", "1", "", null, null, null, null, null);
+ SiteMapNode node1 = new SiteMapNode (new DummyProvider (), "Node", "1", "", null, null, null, null, null);
+ SiteMapNode node2 = new SiteMapNode (new DummyProvider (), "Node", "2", "", null, null, new NameValueCollection (), null, null);
+ Assert.IsTrue (node.Equals (node1), "both nodes have attrib=null");
Assert.IsFalse (node.Equals (node2), "one node has attrib=null");
}
SiteMapNode node1 = new SiteMapNode (new DummyProvider (), "", "", "", null, null, null, null, null);
SiteMapNode node2 = new SiteMapNode (new DummyProvider (), "", "", "", null, new int[] { }, null, null, null);
Assert.IsTrue (node.Equals (node1));
- Assert.IsFalse (node.Equals (node2));
+ Assert.IsTrue (node.Equals (node2));
}
[Test]
public void Node_Null_Attrib_clone ()
{
SiteMapNode node = new SiteMapNode (new DummyProvider (), "", "", "", null, null, null, null, null);
- node.Clone ();
+ SiteMapNode copy = node.Clone ();
+ Assert.IsNotNull (copy, "Node not created");
+ Assert.AreEqual (copy, node, "Cloning failed");
}
}
}
}
[Test]
- [ExpectedException (typeof (ArgumentNullException))]
+ [Category ("NotWorking")]
+ [ExpectedException (typeof (ArgumentException))]
public void Combine_ArgException2 ()
{
Assert.AreEqual ("hi/there", VPU.Combine ("hi/there", null), "A1");
}
[Test]
- [ExpectedException (typeof (ArgumentNullException))]
+ [Category ("NotWorking")]
+ [ExpectedException (typeof (ArgumentException))]
public void Combine2 ()
{
VPU.Combine ("something", null);
}
[Test]
- [ExpectedException (typeof (ArgumentException))]
+ [ExpectedException (typeof (ArgumentNullException))]
public void GetDirectory2 ()
{
VPU.GetDirectory ("");
}
[Test]
- [ExpectedException (typeof (ArgumentNullException))]
+ [ExpectedException (typeof (ArgumentException))]
public void GetDirectory3 ()
{
VPU.GetDirectory ("hola");
{
Assert.AreEqual ("", VPU.GetExtension ("/direc/somefilenoextension"));
Assert.AreEqual ("", VPU.GetExtension ("/"));
- Assert.AreEqual (".aspx", VPU.GetDirectory ("/////direc///somefile.aspx"));
+ Assert.AreEqual ("/direc/", VPU.GetDirectory ("/////direc///somefile.aspx"));
}
[Test]
}
}
-#endif
-
+#endif\r
+\r