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,295 @@
//
// Authors:
// Marek Habersack (mhabersack@novell.com)
//
// (C) 2010 Novell, Inc http://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_4_0
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Configuration.Provider;
using System.IO;
using System.Web;
using System.Web.Hosting;
using StandAloneRunnerSupport;
using StandAloneTests;
using NUnit.Framework;
namespace StandAloneTests.ApplicationPreStartMethods
{
[TestCase ("ApplicationPreStartMethods 01", "Tests whether pre application start methods work correctly")]
public sealed class ApplicationPreStartMethods_01 : ITestCase
{
public string PhysicalPath {
get {
return Path.Combine (
Consts.BasePhysicalDir,
"ApplicationPreStartMethods",
"test_01",
"ApplicationPreStartMethods"
);
}
}
public string VirtualPath {
get { return "/"; }
}
public bool SetUp (List <TestRunItem> runItems)
{
runItems.Add (new TestRunItem ("/default.aspx", Default_Aspx));
return true;
}
void Default_Aspx (string result, TestRunItem runItem)
{
string originalHtml = @"<div>Report:<pre id=""report"">Public static method called
ExternalAssembly1 added
</pre></div>";
Helpers.ExtractAndCompareCodeFromHtml (result, originalHtml, "#A1");
}
}
[TestCase ("ApplicationPreStartMethods 02", "Throw exception when pre-start method is not public and static - public instance method used here.")]
public sealed class ApplicationPreStartMethods_02 : ITestCase
{
public string PhysicalPath {
get {
return Path.Combine (
Consts.BasePhysicalDir,
"ApplicationPreStartMethods",
"test_02",
"ApplicationPreStartMethods"
);
}
}
public string VirtualPath {
get { return "/"; }
}
public bool SetUp (List <TestRunItem> runItems)
{
runItems.Add (new TestRunItem ("/default.aspx", Default_Aspx));
return true;
}
void Default_Aspx (string result, TestRunItem runItem)
{
Assert.AreNotEqual (-1, result.IndexOf ("[System.Web.HttpException]: The method specified by the PreApplicationStartMethodAttribute on assembly"), "#A1");
}
}
[TestCase ("ApplicationPreStartMethods 03", "Throw exception when pre-start method is not public and static - internal instance method used here.")]
public sealed class ApplicationPreStartMethods_03 : ITestCase
{
public string PhysicalPath {
get {
return Path.Combine (
Consts.BasePhysicalDir,
"ApplicationPreStartMethods",
"test_03",
"ApplicationPreStartMethods"
);
}
}
public string VirtualPath {
get { return "/"; }
}
public bool SetUp (List <TestRunItem> runItems)
{
runItems.Add (new TestRunItem ("/default.aspx", Default_Aspx));
return true;
}
void Default_Aspx (string result, TestRunItem runItem)
{
Assert.AreNotEqual (-1, result.IndexOf ("[System.Web.HttpException]: The method specified by the PreApplicationStartMethodAttribute on assembly"), "#A1");
}
}
[TestCase ("ApplicationPreStartMethods 04", "Throw exception when pre-start method is not public and static - internal static method used here.")]
public sealed class ApplicationPreStartMethods_04 : ITestCase
{
public string PhysicalPath {
get {
return Path.Combine (
Consts.BasePhysicalDir,
"ApplicationPreStartMethods",
"test_04",
"ApplicationPreStartMethods"
);
}
}
public string VirtualPath {
get { return "/"; }
}
public bool SetUp (List <TestRunItem> runItems)
{
runItems.Add (new TestRunItem ("/default.aspx", Default_Aspx));
return true;
}
void Default_Aspx (string result, TestRunItem runItem)
{
Assert.AreNotEqual (-1, result.IndexOf ("[System.Web.HttpException]: The method specified by the PreApplicationStartMethodAttribute on assembly"), "#A1");
}
}
[TestCase ("ApplicationPreStartMethods 05", "Throw exception when pre-start method is not public and static - private instance method used here.")]
public sealed class ApplicationPreStartMethods_05 : ITestCase
{
public string PhysicalPath {
get {
return Path.Combine (
Consts.BasePhysicalDir,
"ApplicationPreStartMethods",
"test_05",
"ApplicationPreStartMethods"
);
}
}
public string VirtualPath {
get { return "/"; }
}
public bool SetUp (List <TestRunItem> runItems)
{
runItems.Add (new TestRunItem ("/default.aspx", Default_Aspx));
return true;
}
void Default_Aspx (string result, TestRunItem runItem)
{
Assert.AreNotEqual (-1, result.IndexOf ("[System.Web.HttpException]: The method specified by the PreApplicationStartMethodAttribute on assembly"), "#A1");
}
}
[TestCase ("ApplicationPreStartMethods 06", "Throw exception when pre-start method is not public and static - private static method used here.")]
public sealed class ApplicationPreStartMethods_06 : ITestCase
{
public string PhysicalPath {
get {
return Path.Combine (
Consts.BasePhysicalDir,
"ApplicationPreStartMethods",
"test_06",
"ApplicationPreStartMethods"
);
}
}
public string VirtualPath {
get { return "/"; }
}
public bool SetUp (List <TestRunItem> runItems)
{
runItems.Add (new TestRunItem ("/default.aspx", Default_Aspx));
return true;
}
void Default_Aspx (string result, TestRunItem runItem)
{
Assert.AreNotEqual (-1, result.IndexOf ("[System.Web.HttpException]: The method specified by the PreApplicationStartMethodAttribute on assembly"), "#A1");
}
}
[TestCase ("ApplicationPreStartMethods 07", "Throw exception when pre-start method is not public and static - public static method found in the base class.")]
public sealed class ApplicationPreStartMethods_07 : ITestCase
{
public string PhysicalPath {
get {
return Path.Combine (
Consts.BasePhysicalDir,
"ApplicationPreStartMethods",
"test_07",
"ApplicationPreStartMethods"
);
}
}
public string VirtualPath {
get { return "/"; }
}
public bool SetUp (List <TestRunItem> runItems)
{
runItems.Add (new TestRunItem ("/default.aspx", Default_Aspx));
return true;
}
void Default_Aspx (string result, TestRunItem runItem)
{
Assert.AreNotEqual (-1, result.IndexOf ("[System.Web.HttpException]: The method specified by the PreApplicationStartMethodAttribute on assembly"), "#A1");
}
}
[TestCase ("ApplicationPreStartMethods 08", "Pre-start method throws an exception")]
public sealed class ApplicationPreStartMethods_08 : ITestCase
{
public string PhysicalPath {
get {
return Path.Combine (
Consts.BasePhysicalDir,
"ApplicationPreStartMethods",
"test_08",
"ApplicationPreStartMethods"
);
}
}
public string VirtualPath {
get { return "/"; }
}
public bool SetUp (List <TestRunItem> runItems)
{
runItems.Add (new TestRunItem ("/default.aspx", Default_Aspx));
return true;
}
void Default_Aspx (string result, TestRunItem runItem)
{
Assert.AreNotEqual (-1, result.IndexOf ("[System.Web.HttpException]: The pre-application start initialization method PublicStaticMethod on type ApplicationPreStartMethods.Tests.PreStartMethods"), "#A1");
}
}
}
#endif

View File

@@ -0,0 +1,160 @@
//
// Authors:
// Marek Habersack (mhabersack@novell.com)
//
// (C) 2010 Novell, Inc http://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_4_0
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Configuration.Provider;
using System.IO;
using System.Web;
using System.Web.Hosting;
using StandAloneRunnerSupport;
using StandAloneTests;
using NUnit.Framework;
namespace StandAloneTests.BuildManagerCacheFiles
{
[TestCase ("BuildManagerCacheFiles 01", "Tests for BuildManager.{Create,Read}CacheFile")]
public sealed class BuildManagerCacheFiles_01 : ITestCase
{
static string[] expectedMessages = {
"create[1]: codeGen",
"create[1]: fileStream",
"create[1]: can read",
"create[1]: can write",
"create[1]: pathSubdirOfCodeGen",
"create[1]: our file name",
"read[1]: codeGen",
"read[1]: fileStream",
"read[1]: can read",
"read[1]: cannot write",
"read[1]: pathSubdirOfCodeGen",
"read[1]: our file name",
"read[1]: contents ok",
"create[2]: codeGen",
// .NET exception:
//
// System.ArgumentException: Value does not fall within the expected range.
// at System.Web.Compilation.BuildManager.GetUserCacheFilePath(String fileName)
// at System.Web.Compilation.BuildManager.CreateCachedFile(String fileName)
// at _Default.RunTest(String fileName, String logTag, List`1 messages, Boolean noCreate) in c:\Users\grendel\Documents\Visual Studio 2010\Websites\BuildManager4.0\Default.aspx.cs:line 56)
"create[2]: error write (System.ArgumentException)",
"read[2]: codeGen",
// .NET exception:
//
// System.ArgumentException: Value does not fall within the expected range.
// at System.Web.Compilation.BuildManager.GetUserCacheFilePath(String fileName)
// at System.Web.Compilation.BuildManager.ReadCachedFile(String fileName)
// at _Default.RunTest(String fileName, String logTag, List`1 messages, Boolean noCreate) in c:\Users\grendel\Documents\Visual Studio 2010\Websites\BuildManager4.0\Default.aspx.cs:line 86)
"read[2]: error read (System.ArgumentException)",
"read[3]: codeGen",
"read[3]: stream is null",
"create[4]: codeGen",
// .NET exception
// System.ArgumentNullException: Value cannot be null.
// Parameter name: path2
// at System.IO.Path.Combine(String path1, String path2)
// at System.Web.Compilation.BuildManager.GetUserCacheFilePath(String fileName)
// at System.Web.Compilation.BuildManager.CreateCachedFile(String fileName)
// at _Default.RunTest(String fileName, String logTag, List`1 messages, Boolean noCreate) in c:\Users\grendel\Documents\Visual Studio 2010\Websites\BuildManager4.0\Default.aspx.cs:line 61)
"create[4]: error write (System.ArgumentNullException)",
"read[4]: codeGen",
// .NET exception
// System.ArgumentNullException: Value cannot be null.
// Parameter name: path2
// at System.IO.Path.Combine(String path1, String path2)
// at System.Web.Compilation.BuildManager.GetUserCacheFilePath(String fileName)
// at System.Web.Compilation.BuildManager.ReadCachedFile(String fileName)
// at _Default.RunTest(String fileName, String logTag, List`1 messages, Boolean noCreate) in c:\Users\grendel\Documents\Visual Studio 2010\Websites\BuildManager4.0\Default.aspx.cs:line 91)
"read[4]: error read (System.ArgumentNullException)",
"create[5]: codeGen",
// .NET exception
// System.ArgumentException: Value does not fall within the expected range.
// at System.Web.Compilation.BuildManager.GetUserCacheFilePath(String fileName)
// at System.Web.Compilation.BuildManager.CreateCachedFile(String fileName)
// at _Default.RunTest(String fileName, String logTag, List`1 messages, Boolean noCreate) in c:\Users\grendel\Documents\Visual Studio 2010\Websites\BuildManager4.0\Default.aspx.cs:line 61)
"create[5]: error write (System.ArgumentException)",
"read[5]: codeGen",
// .NET exception
// System.ArgumentException: Value does not fall within the expected range.
// at System.Web.Compilation.BuildManager.GetUserCacheFilePath(String fileName)
// at System.Web.Compilation.BuildManager.ReadCachedFile(String fileName)
// at _Default.RunTest(String fileName, String logTag, List`1 messages, Boolean noCreate) in c:\Users\grendel\Documents\Visual Studio 2010\Websites\BuildManager4.0\Default.aspx.cs:line 91)
"read[5]: error read (System.ArgumentException)",
};
public string PhysicalPath {
get {
return Path.Combine (
Consts.BasePhysicalDir,
"BuildManagerCacheFiles"
);
}
}
public string VirtualPath {
get { return "/"; }
}
public bool SetUp (List <TestRunItem> runItems)
{
runItems.Add (new TestRunItem ("/Default.aspx", Default_Aspx));
return true;
}
void Default_Aspx (string result, TestRunItem runItem)
{
var messages = runItem.TestRunData as List <string>;
Assert.IsNotNull (messages, "#A1");
int len = messages.Count;
int i = 0;
for (; i < len; i++)
Assert.AreEqual (expectedMessages [i], messages [i], "#A2-" + i.ToString ());
if (i != len)
Assert.Fail ("Expected {0} messages, found {1}", i, len);
}
}
}
#endif

View File

@@ -0,0 +1,63 @@
//
// Authors:
// Marek Habersack (mhabersack@novell.com)
//
// (C) 2010 Novell, Inc http://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.
//
using System;
using System.Collections.Generic;
using System.IO;
using System.Web.Util;
using StandAloneRunnerSupport;
using StandAloneTests;
using NUnit.Framework;
namespace StandAloneTests.ChildrenAsProperties
{
[TestCase ("ChildrenAsProperties", "PagesSection.ChildrenAsProperties")]
public sealed class Test_01 : ITestCase
{
public string PhysicalPath {
get { return Path.Combine (Consts.BasePhysicalDir, "ChildrenAsProperties"); }
}
public string VirtualPath {
get { return "/"; }
}
public bool SetUp (List <TestRunItem> runItems)
{
runItems.Add (new TestRunItem ("default.aspx", Default_Aspx));
return true;
}
void Default_Aspx (string result, TestRunItem runItem)
{
string originalHtml = "<div>12345snap test snap</div>\n<div>123454444</div>\n";
Helpers.ExtractAndCompareCodeFromHtml (result, originalHtml, "#A1");
}
}
}

View File

@@ -0,0 +1,44 @@
//
// Authors:
// Marek Habersack (mhabersack@novell.com)
//
// (C) 2010 Novell, Inc http://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.
//
using System;
using System.IO;
using StandAloneRunnerSupport;
namespace StandAloneTests
{
static class Consts
{
public readonly static string BasePhysicalDir;
static Consts ()
{
BasePhysicalDir = Path.Combine ("@SystemWebClassDir@", Path.Combine ("Test", "standalone"));
}
}
}

View File

@@ -0,0 +1,78 @@
//
// Authors:
// Marek Habersack (mhabersack@novell.com)
//
// (C) 2010 Novell, Inc http://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_4_0
using System;
using System.Collections.Generic;
using System.IO;
using System.Web.Util;
using StandAloneRunnerSupport;
using StandAloneTests;
using NUnit.Framework;
namespace StandAloneTests.ControlRenderingCompatibilityVersion
{
[TestCase ("ControlRenderingCompatibilityVersion", "PagesSection.ControlRenderingCompatibilityVersion")]
public sealed class Test_01 : ITestCase
{
public string PhysicalPath {
get { return Path.Combine (Consts.BasePhysicalDir, "ControlRenderingCompatibilityVersion"); }
}
public string VirtualPath {
get { return "/"; }
}
public bool SetUp (List <TestRunItem> runItems)
{
runItems.Add (new TestRunItem ("Default.aspx", Default_Aspx));
runItems.Add (new TestRunItem ("LessThan3.5/Default.aspx", Default_Aspx_LessThan35));
runItems.Add (new TestRunItem ("MoreThan4.0/Default.aspx", Default_Aspx_MoreThan40));
return true;
}
void Default_Aspx (string result, TestRunItem runItem)
{
string originalHtml = "4.0 2.0";
Helpers.ExtractAndCompareCodeFromHtml (result, originalHtml, "#A1");
}
void Default_Aspx_LessThan35 (string result, TestRunItem runItem)
{
Assert.IsTrue (result.IndexOf ("[System.Configuration.ConfigurationErrorsException]") != -1, "#A1");
}
void Default_Aspx_MoreThan40 (string result, TestRunItem runItem)
{
string originalHtml = "5.0";
Helpers.ExtractAndCompareCodeFromHtml (result, originalHtml, "#A1");
}
}
}
#endif

View File

@@ -0,0 +1,116 @@
//
// Authors:
// Marek Habersack (mhabersack@novell.com)
//
// (C) 2010 Novell, Inc http://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_4_0
using System;
using System.Collections.Generic;
using System.IO;
using System.Web.Util;
using StandAloneRunnerSupport;
using StandAloneTests;
using NUnit.Framework;
namespace StandAloneTests.Control_GetUniqueIDRelativeTo
{
[TestCase ("Control_GetUniqueIDRelativeTo", "Control.GetUniqueIDRelativeTo tests")]
public sealed class Control_GetUniqueIDRelativeTo : ITestCase
{
public string PhysicalPath {
get { return Path.Combine (Consts.BasePhysicalDir, "Control_GetUniqueIDRelativeTo"); }
}
public string VirtualPath {
get { return "/"; }
}
public bool SetUp (List <TestRunItem> runItems)
{
runItems.Add (new TestRunItem ("default.aspx", Default_Aspx));
return true;
}
void Default_Aspx (string result, TestRunItem runItem)
{
string originalHtml = @"<pre id=""log"">Page; Relative to: null; Result: exception System.ArgumentNullException (expected)
A control; Relative to: __Page; Result: exception System.InvalidOperationException (expected)
TextBox; Relative to: __Page; Result: exception System.InvalidOperationException (expected)
Item: 0; Relative to: repeater1$ctl00; Result: &#39;ctl00$label1&#39;
Item: 0; Relative to: repeater1; Result: &#39;repeater1$ctl00$label1&#39;
Item: 0; Relative to: __Page; Result: exception System.InvalidOperationException (expected)
Item: 0; Relative to: repeater1$ctl00$innerRepeater1$ctl00; Result: &#39;ctl00$innerLabel1&#39;
Item: 0; Relative to: repeater1; Result: &#39;repeater1$ctl00$innerRepeater1$ctl00$innerLabel1&#39;
Item: 0; Relative to: repeater1$ctl00$innerRepeater1; Result: &#39;innerRepeater1$ctl00$innerLabel1&#39;
Item: 0; Relative to: __Page; Result: exception System.InvalidOperationException (expected)
Item: 1; Relative to: repeater1$ctl00$innerRepeater1$ctl01; Result: &#39;ctl01$innerLabel1&#39;
Item: 1; Relative to: repeater1; Result: &#39;repeater1$ctl00$innerRepeater1$ctl01$innerLabel1&#39;
Item: 1; Relative to: repeater1$ctl00$innerRepeater1; Result: &#39;innerRepeater1$ctl01$innerLabel1&#39;
Item: 1; Relative to: __Page; Result: exception System.InvalidOperationException (expected)
Item: 2; Relative to: repeater1$ctl00$innerRepeater1$ctl02; Result: &#39;ctl02$innerLabel1&#39;
Item: 2; Relative to: repeater1; Result: &#39;repeater1$ctl00$innerRepeater1$ctl02$innerLabel1&#39;
Item: 2; Relative to: repeater1$ctl00$innerRepeater1; Result: &#39;innerRepeater1$ctl02$innerLabel1&#39;
Item: 2; Relative to: __Page; Result: exception System.InvalidOperationException (expected)
Item: 1; Relative to: repeater1$ctl02; Result: &#39;ctl02$label1&#39;
Item: 1; Relative to: repeater1; Result: &#39;repeater1$ctl02$label1&#39;
Item: 1; Relative to: __Page; Result: exception System.InvalidOperationException (expected)
Item: 0; Relative to: repeater1$ctl02$innerRepeater1$ctl00; Result: &#39;ctl00$innerLabel1&#39;
Item: 0; Relative to: repeater1; Result: &#39;repeater1$ctl02$innerRepeater1$ctl00$innerLabel1&#39;
Item: 0; Relative to: repeater1$ctl02$innerRepeater1; Result: &#39;innerRepeater1$ctl00$innerLabel1&#39;
Item: 0; Relative to: __Page; Result: exception System.InvalidOperationException (expected)
Item: 1; Relative to: repeater1$ctl02$innerRepeater1$ctl01; Result: &#39;ctl01$innerLabel1&#39;
Item: 1; Relative to: repeater1; Result: &#39;repeater1$ctl02$innerRepeater1$ctl01$innerLabel1&#39;
Item: 1; Relative to: repeater1$ctl02$innerRepeater1; Result: &#39;innerRepeater1$ctl01$innerLabel1&#39;
Item: 1; Relative to: __Page; Result: exception System.InvalidOperationException (expected)
Item: 2; Relative to: repeater1$ctl02$innerRepeater1$ctl02; Result: &#39;ctl02$innerLabel1&#39;
Item: 2; Relative to: repeater1; Result: &#39;repeater1$ctl02$innerRepeater1$ctl02$innerLabel1&#39;
Item: 2; Relative to: repeater1$ctl02$innerRepeater1; Result: &#39;innerRepeater1$ctl02$innerLabel1&#39;
Item: 2; Relative to: __Page; Result: exception System.InvalidOperationException (expected)
Item: 2; Relative to: repeater1$ctl04; Result: &#39;ctl04$label1&#39;
Item: 2; Relative to: repeater1; Result: &#39;repeater1$ctl04$label1&#39;
Item: 2; Relative to: __Page; Result: exception System.InvalidOperationException (expected)
Item: 0; Relative to: repeater1$ctl04$innerRepeater1$ctl00; Result: &#39;ctl00$innerLabel1&#39;
Item: 0; Relative to: repeater1; Result: &#39;repeater1$ctl04$innerRepeater1$ctl00$innerLabel1&#39;
Item: 0; Relative to: repeater1$ctl04$innerRepeater1; Result: &#39;innerRepeater1$ctl00$innerLabel1&#39;
Item: 0; Relative to: __Page; Result: exception System.InvalidOperationException (expected)
Item: 1; Relative to: repeater1$ctl04$innerRepeater1$ctl01; Result: &#39;ctl01$innerLabel1&#39;
Item: 1; Relative to: repeater1; Result: &#39;repeater1$ctl04$innerRepeater1$ctl01$innerLabel1&#39;
Item: 1; Relative to: repeater1$ctl04$innerRepeater1; Result: &#39;innerRepeater1$ctl01$innerLabel1&#39;
Item: 1; Relative to: __Page; Result: exception System.InvalidOperationException (expected)
Item: 2; Relative to: repeater1$ctl04$innerRepeater1$ctl02; Result: &#39;ctl02$innerLabel1&#39;
Item: 2; Relative to: repeater1; Result: &#39;repeater1$ctl04$innerRepeater1$ctl02$innerLabel1&#39;
Item: 2; Relative to: repeater1$ctl04$innerRepeater1; Result: &#39;innerRepeater1$ctl02$innerLabel1&#39;
Item: 2; Relative to: __Page; Result: exception System.InvalidOperationException (expected)
</pre>";
Helpers.ExtractAndCompareCodeFromHtml (result, originalHtml, "#A1");
}
}
}
#endif

View File

@@ -0,0 +1,103 @@
//
// Authors:
// Marek Habersack (mhabersack@novell.com)
//
// (C) 2010 Novell, Inc http://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_4_0
using System;
using System.Collections.Generic;
using System.IO;
using System.Web.Util;
using StandAloneRunnerSupport;
using StandAloneTests;
using NUnit.Framework;
namespace StandAloneTests.DisabledAttributeRendering
{
[TestCase ("DisabledAttributeRendering 01", "4.0 does not render the 'disabled' attribute in default mode. Using default CSS class name.")]
public sealed class Test_01 : ITestCase
{
public string PhysicalPath {
get { return Path.Combine (Consts.BasePhysicalDir, "DisabledAttributeRendering", "DefaultClassName"); }
}
public string VirtualPath {
get { return "/"; }
}
public bool SetUp (List <TestRunItem> runItems)
{
runItems.Add (new TestRunItem ("Default.aspx", Default_Aspx));
runItems.Add (new TestRunItem ("OldRendering/Default.aspx", OldRendering_Default_Aspx));
return true;
}
void Default_Aspx (string result, TestRunItem runItem)
{
string originalHtml = "<div class=\"aspNetDisabled MyClass\">\r\n\tI am disabled\r\n</div><a class=\"aspNetDisabled\">Disabled link</a>";
Helpers.ExtractAndCompareCodeFromHtml (result, originalHtml, "#A1");
}
void OldRendering_Default_Aspx (string result, TestRunItem runItem)
{
string originalHtml = "<div disabled=\"disabled\" class=\"MyClass\">\r\n\tI am disabled\r\n</div><a disabled=\"disabled\">Disabled link</a>";
Helpers.ExtractAndCompareCodeFromHtml (result, originalHtml, "#A1");
}
}
[TestCase ("DisabledAttributeRendering 02", "4.0 does not render the 'disabled' attribute in default mode. Using custom CSS class name.")]
public sealed class Test_02 : ITestCase
{
public string PhysicalPath {
get { return Path.Combine (Consts.BasePhysicalDir, "DisabledAttributeRendering", "CustomClassName"); }
}
public string VirtualPath {
get { return "/"; }
}
public bool SetUp (List <TestRunItem> runItems)
{
runItems.Add (new TestRunItem ("Default.aspx", Default_Aspx));
runItems.Add (new TestRunItem ("OldRendering/Default.aspx", OldRendering_Default_Aspx));
return true;
}
void Default_Aspx (string result, TestRunItem runItem)
{
string originalHtml = "<div class=\"MyDisabledControlClass MyClass\">\r\n\tI am disabled\r\n</div><a class=\"MyDisabledControlClass\">Disabled link</a>";
Helpers.ExtractAndCompareCodeFromHtml (result, originalHtml, "#A1");
}
void OldRendering_Default_Aspx (string result, TestRunItem runItem)
{
string originalHtml = "<div disabled=\"disabled\" class=\"MyClass\">\r\n\tI am disabled\r\n</div><a disabled=\"disabled\">Disabled link</a>";
Helpers.ExtractAndCompareCodeFromHtml (result, originalHtml, "#A1");
}
}
}
#endif

View File

@@ -0,0 +1,323 @@
//
// Authors:
// Marek Habersack (mhabersack@novell.com)
//
// (C) 2010 Novell, Inc http://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_4_0
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Configuration.Provider;
using System.IO;
using System.Web;
using System.Web.Hosting;
using StandAloneRunnerSupport;
using StandAloneTests;
using NUnit.Framework;
namespace StandAloneTests.EnableFormsAuthentication
{
[TestCase ("EnableFormsAuthentication 01", "Check if null is accepted as the parameter")]
public sealed class EnableFormsAuthentication_01 : ITestCase
{
public string PhysicalPath {
get {
return Path.Combine (
Consts.BasePhysicalDir,
"EnableFormsAuthentication",
"Test_01"
);
}
}
public string VirtualPath {
get { return "/"; }
}
public bool SetUp (List <TestRunItem> runItems)
{
runItems.Add (new TestRunItem ("/default.aspx", Default_Aspx));
return true;
}
void Default_Aspx (string result, TestRunItem runItem)
{
string originalHtml = @"<div>Default URL: /default.aspx<br />Login URL: /login.aspx</div>";
Helpers.ExtractAndCompareCodeFromHtml (result, originalHtml, "#A1");
}
}
[TestCase ("EnableFormsAuthentication 02", "Check if an empty collection is accepted as the parameter")]
public sealed class EnableFormsAuthentication_02 : ITestCase
{
public string PhysicalPath {
get {
return Path.Combine (
Consts.BasePhysicalDir,
"EnableFormsAuthentication",
"Test_02"
);
}
}
public string VirtualPath {
get { return "/"; }
}
public bool SetUp (List <TestRunItem> runItems)
{
runItems.Add (new TestRunItem ("/default.aspx", Default_Aspx));
return true;
}
void Default_Aspx (string result, TestRunItem runItem)
{
string originalHtml = @"<div>Default URL: /default.aspx<br />Login URL: /login.aspx</div>";
Helpers.ExtractAndCompareCodeFromHtml (result, originalHtml, "#A1");
}
}
[TestCase ("EnableFormsAuthentication 03", "Sets both documented properties.")]
public sealed class EnableFormsAuthentication_03 : ITestCase
{
public string PhysicalPath {
get {
return Path.Combine (
Consts.BasePhysicalDir,
"EnableFormsAuthentication",
"Test_03"
);
}
}
public string VirtualPath {
get { return "/"; }
}
public bool SetUp (List <TestRunItem> runItems)
{
runItems.Add (new TestRunItem ("/default.aspx", Default_Aspx));
return true;
}
void Default_Aspx (string result, TestRunItem runItem)
{
string originalHtml = @"<div>Default URL: /myDefault.aspx<br />Login URL: /myLogin.aspx</div>";
Helpers.ExtractAndCompareCodeFromHtml (result, originalHtml, "#A1");
}
}
[TestCase ("EnableFormsAuthentication 04", "Checks whether empty strings are accepted as config items value")]
public sealed class EnableFormsAuthentication_04 : ITestCase
{
public string PhysicalPath {
get {
return Path.Combine (
Consts.BasePhysicalDir,
"EnableFormsAuthentication",
"Test_04"
);
}
}
public string VirtualPath {
get { return "/"; }
}
public bool SetUp (List <TestRunItem> runItems)
{
runItems.Add (new TestRunItem ("/default.aspx", Default_Aspx));
return true;
}
void Default_Aspx (string result, TestRunItem runItem)
{
string originalHtml = @"<div>Default URL: /default.aspx<br />Login URL: /login.aspx</div>";
Helpers.ExtractAndCompareCodeFromHtml (result, originalHtml, "#A1");
}
}
[TestCase ("EnableFormsAuthentication 05", "Checks whether null is accepted as config items value")]
public sealed class EnableFormsAuthentication_05 : ITestCase
{
public string PhysicalPath {
get {
return Path.Combine (
Consts.BasePhysicalDir,
"EnableFormsAuthentication",
"Test_05"
);
}
}
public string VirtualPath {
get { return "/"; }
}
public bool SetUp (List <TestRunItem> runItems)
{
runItems.Add (new TestRunItem ("/default.aspx", Default_Aspx));
return true;
}
void Default_Aspx (string result, TestRunItem runItem)
{
string originalHtml = @"<div>Default URL: /default.aspx<br />Login URL: /login.aspx</div>";
Helpers.ExtractAndCompareCodeFromHtml (result, originalHtml, "#A1");
}
}
[TestCase ("EnableFormsAuthentication 06", "Checks whether config item names are case-sensitive.")]
public sealed class EnableFormsAuthentication_06 : ITestCase
{
public string PhysicalPath {
get {
return Path.Combine (
Consts.BasePhysicalDir,
"EnableFormsAuthentication",
"Test_06"
);
}
}
public string VirtualPath {
get { return "/"; }
}
public bool SetUp (List <TestRunItem> runItems)
{
runItems.Add (new TestRunItem ("/default.aspx", Default_Aspx));
return true;
}
void Default_Aspx (string result, TestRunItem runItem)
{
string originalHtml = @"<div>Default URL: /myDefault.aspx<br />Login URL: /myLogin.aspx</div>";
Helpers.ExtractAndCompareCodeFromHtml (result, originalHtml, "#A1");
}
}
[TestCase ("EnableFormsAuthentication 07", "Checks if only loginUrl and defaultUrl are set with this method.")]
public sealed class EnableFormsAuthentication_07 : ITestCase
{
public string PhysicalPath {
get {
return Path.Combine (
Consts.BasePhysicalDir,
"EnableFormsAuthentication",
"Test_07"
);
}
}
public string VirtualPath {
get { return "/"; }
}
public bool SetUp (List <TestRunItem> runItems)
{
runItems.Add (new TestRunItem ("/default.aspx", Default_Aspx));
return true;
}
void Default_Aspx (string result, TestRunItem runItem)
{
string originalHtml = @"<div>Default URL: /myDefault.aspx<br />Login URL: /myLogin.aspx<br />Cookie domain: </div>";
Helpers.ExtractAndCompareCodeFromHtml (result, originalHtml, "#A1");
}
}
[TestCase ("EnableFormsAuthentication 08", "Checks whether multiple calls to the method are possible and that the last values passed take precedence.")]
public sealed class EnableFormsAuthentication_08 : ITestCase
{
public string PhysicalPath {
get {
return Path.Combine (
Consts.BasePhysicalDir,
"EnableFormsAuthentication",
"Test_08"
);
}
}
public string VirtualPath {
get { return "/"; }
}
public bool SetUp (List <TestRunItem> runItems)
{
runItems.Add (new TestRunItem ("/default.aspx", Default_Aspx));
return true;
}
void Default_Aspx (string result, TestRunItem runItem)
{
string originalHtml = @"<div>Default URL: /myOtherDefault.aspx<br />Login URL: /myOtherLogin.aspx<br />Cookie domain: </div>";
Helpers.ExtractAndCompareCodeFromHtml (result, originalHtml, "#A1");
}
}
[TestCase ("EnableFormsAuthentication 09", "Check whether values passed to the method take precedence over those in web.config")]
public sealed class EnableFormsAuthentication_09 : ITestCase
{
public string PhysicalPath {
get {
return Path.Combine (
Consts.BasePhysicalDir,
"EnableFormsAuthentication",
"Test_09"
);
}
}
public string VirtualPath {
get { return "/"; }
}
public bool SetUp (List <TestRunItem> runItems)
{
runItems.Add (new TestRunItem ("/default.aspx", Default_Aspx));
return true;
}
void Default_Aspx (string result, TestRunItem runItem)
{
string originalHtml = @"<div>Default URL: /myDefault.aspx<br />Login URL: /myLogin.aspx<br />Cookie domain: </div>";
Helpers.ExtractAndCompareCodeFromHtml (result, originalHtml, "#A1");
}
}
}
#endif

View File

@@ -0,0 +1,113 @@
//
// Authors:
// Marek Habersack (mhabersack@novell.com)
//
// (C) 2010 Novell, Inc http://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.
//
using System;
using System.Collections.Generic;
using System.IO;
using System.Web.Util;
using StandAloneRunnerSupport;
using StandAloneTests;
using NUnit.Framework;
namespace StandAloneTests.FormViewUpdateParameters_Bug607722
{
[TestCase ("FormViewUpdateParameters_Bug607722", "FormView update parameters should include keys")]
public sealed class Test_01 : ITestCase
{
public string PhysicalPath {
get { return Path.Combine (Consts.BasePhysicalDir, "FormViewUpdateParameters_Bug607722"); }
}
public string VirtualPath {
get { return "/"; }
}
public bool SetUp (List <TestRunItem> runItems)
{
runItems.Add (new TestRunItem ("Default.aspx", Default_Aspx));
#if BUG_IN_THE_RUNTIME_IS_FIXED
// With this version of code, the runtime segfaults. Until this is fixed,
// we'll be using an alternative version of the code
runItems.Add (new TestRunItem ("Default.aspx", null) {
PostValues = new SerializableDictionary <string, string> {
{"__EVENTTARGET", "FormView1$EditButton"},
{"__EVENTARGUMENT", String.Empty}
},
UrlDescription = "Edit phase"
}
);
runItems.Add (new TestRunItem ("Default.aspx", Default_Aspx_POST) {
PostValues = new SerializableDictionary <string, string> {
{"__EVENTTARGET", "FormView1$UpdateButton"},
{"__EVENTARGUMENT", String.Empty},
{"FormView1$M1TextBox", "12"},
{"FormView1$M2TextBox", "12"}
},
UrlDescription = "Update phase"
}
);
#else
runItems.Add (new TestRunItem ("Default.aspx", null) {
PostValues = new string[] {
"__EVENTTARGET", "FormView1$EditButton",
"__EVENTARGUMENT", String.Empty
},
UrlDescription = "Edit phase"
}
);
runItems.Add (new TestRunItem ("Default.aspx", Default_Aspx_Update) {
PostValues = new string[] {
"__EVENTTARGET", "FormView1$UpdateButton",
"__EVENTARGUMENT", String.Empty,
"FormView1$M1TextBox", "12",
"FormView1$M2TextBox", "12"
},
UrlDescription = "Update phase"
}
);
#endif
return true;
}
void Default_Aspx (string result, TestRunItem runItem)
{
string originalHtml = @"M1: <span id=""FormView1_M1Label"">0</span><br />M2: <span id=""FormView1_M2Label"">0</span>";
Helpers.ExtractAndCompareCodeFromHtml (result, originalHtml, "#A1");
}
void Default_Aspx_Update (string result, TestRunItem runItem)
{
string originalHtml = @"M1: <span id=""FormView1_M1Label"">12</span><br />M2: <span id=""FormView1_M2Label"">12</span>";
Helpers.ExtractAndCompareCodeFromHtml (result, originalHtml, "#A1");
}
}
}

View File

@@ -0,0 +1,87 @@
//
// Authors:
// Marek Habersack (mhabersack@novell.com)
//
// (C) 2010 Novell, Inc http://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_4_0
using System;
using System.Collections.Generic;
using System.IO;
using System.Web.Util;
using StandAloneRunnerSupport;
using StandAloneTests;
using NUnit.Framework;
namespace StandAloneTests.GridViewShowHeaderWhenEmpty
{
[TestCase ("GridViewShowHeaderWhenEmpty 01", "GridView.ShowHeaderWhenEmpty tests")]
public sealed class Test_01 : ITestCase
{
public string PhysicalPath {
get { return Path.Combine (Consts.BasePhysicalDir, "GridViewShowHeaderWhenEmpty"); }
}
public string VirtualPath {
get { return "/"; }
}
public bool SetUp (List <TestRunItem> runItems)
{
runItems.Add (new TestRunItem ("Default.aspx", Default_Aspx));
runItems.Add (new TestRunItem ("NoHeaderAtAll.aspx", NoHeaderAtAll_Aspx));
runItems.Add (new TestRunItem ("NoHeaderWhenEmpty.aspx", NoHeaderWhenEmpty_Aspx));
runItems.Add (new TestRunItem ("WithHeaderWhenEmpty.aspx", WithHeaderWhenEmpty_Aspx));
return true;
}
void Default_Aspx (string result, TestRunItem runItem)
{
string originalHtml = "<div>\r\n\r\n</div><pre id=\"log\"></pre>";
Helpers.ExtractAndCompareCodeFromHtml (result, originalHtml, "#A1");
}
void NoHeaderAtAll_Aspx (string result, TestRunItem runItem)
{
string originalHtml = "<div>\r\n\r\n</div><pre id=\"log\"></pre>";
Helpers.ExtractAndCompareCodeFromHtml (result, originalHtml, "#A1");
}
void NoHeaderWhenEmpty_Aspx (string result, TestRunItem runItem)
{
string originalHtml = "<div>\r\n\r\n</div><pre id=\"log\"></pre>";
Helpers.ExtractAndCompareCodeFromHtml (result, originalHtml, "#A1");
}
void WithHeaderWhenEmpty_Aspx (string result, TestRunItem runItem)
{
string originalHtml = "<div>\r\n\t<table cellspacing=\"0\" rules=\"all\" border=\"1\" id=\"GridView1\" style=\"border-collapse:collapse;\">\r\n\t\t<tr>\r\n\t\t\t<th scope=\"col\">ProductID</th><th scope=\"col\">ProductName</th><th scope=\"col\">ProductComment</th>\r\n\t\t</tr>\r\n\t</table>\r\n</div><pre id=\"log\">OnRowCreated called</pre>";
Helpers.ExtractAndCompareCodeFromHtml (result, originalHtml, "#A1");
}
}
}
#endif

View File

@@ -0,0 +1,121 @@
//
// Authors:
// Marek Habersack (mhabersack@novell.com)
//
// (C) 2010 Novell, Inc http://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_4_0
using System;
using System.Collections.Generic;
using System.IO;
using System.Web.Util;
using StandAloneRunnerSupport;
using StandAloneTests;
using NUnit.Framework;
namespace StandAloneTests.GridViewSortingStyles
{
[TestCase ("GridViewSortingStyles 01", "GridView supports separate styles for headers/cells when sorting.")]
public sealed class Test_01 : ITestCase
{
public string PhysicalPath {
get { return Path.Combine (Consts.BasePhysicalDir, "GridViewSortingStyles"); }
}
public string VirtualPath {
get { return "/"; }
}
public bool SetUp (List <TestRunItem> runItems)
{
runItems.Add (new TestRunItem ("Default.aspx", Default_Aspx));
runItems.Add (new TestRunItem ("Default.aspx", Default_Aspx_Ascending_ProductName) {
PostValues = new string[] {
"__EVENTTARGET", "GridView1",
"__EVENTARGUMENT", "Sort$ProductName"
},
UrlDescription = "Ascending sorting on ProductName"
}
);
runItems.Add (new TestRunItem ("Default.aspx", Default_Aspx_Descending_ProductName) {
PostValues = new string[] {
"__EVENTTARGET", "GridView1",
"__EVENTARGUMENT", "Sort$ProductName"
},
UrlDescription = "Descending sorting on ProductName"
}
);
runItems.Add (new TestRunItem ("Default.aspx", Default_Aspx_Ascending_ProductID) {
PostValues = new string[] {
"__EVENTTARGET", "GridView1",
"__EVENTARGUMENT", "Sort$ProductID"
},
UrlDescription = "Ascending sorting on ProductID"
}
);
runItems.Add (new TestRunItem ("Default.aspx", Default_Aspx_Descending_ProductID) {
PostValues = new string[] {
"__EVENTTARGET", "GridView1",
"__EVENTARGUMENT", "Sort$ProductID"
},
UrlDescription = "Descending sorting on ProductID"
}
);
return true;
}
void Default_Aspx (string result, TestRunItem runItem)
{
string originalHtml = "<div>\r\n\t<table cellspacing=\"0\" rules=\"all\" border=\"1\" id=\"GridView1\" style=\"border-collapse:collapse;\">\r\n\t\t<tr>\r\n\t\t\t<th scope=\"col\"><a href=\"javascript:__doPostBack(&#39;GridView1&#39;,&#39;Sort$ProductName&#39;)\">Name</a></th><th scope=\"col\"><a href=\"javascript:__doPostBack(&#39;GridView1&#39;,&#39;Sort$ProductID&#39;)\">ID</a></th>\r\n\t\t</tr><tr>\r\n\t\t\t<td>Pear</td><td>1</td>\r\n\t\t</tr><tr>\r\n\t\t\t<td>Apple</td><td>2</td>\r\n\t\t</tr><tr>\r\n\t\t\t<td>Orange</td><td>3</td>\r\n\t\t</tr>\r\n\t</table>\r\n</div>";
Helpers.ExtractAndCompareCodeFromHtml (result, originalHtml, "#A1");
}
void Default_Aspx_Ascending_ProductName (string result, TestRunItem runItem)
{
string originalHtml = "<div>\r\n\t<table cellspacing=\"0\" rules=\"all\" border=\"1\" id=\"GridView1\" style=\"border-collapse:collapse;\">\r\n\t\t<tr>\r\n\t\t\t<th scope=\"col\" style=\"background-color:Yellow;\"><a href=\"javascript:__doPostBack(&#39;GridView1&#39;,&#39;Sort$ProductName&#39;)\">Name</a></th><th scope=\"col\"><a href=\"javascript:__doPostBack(&#39;GridView1&#39;,&#39;Sort$ProductID&#39;)\">ID</a></th>\r\n\t\t</tr><tr>\r\n\t\t\t<td style=\"background-color:LightYellow;\">Apple</td><td>2</td>\r\n\t\t</tr><tr>\r\n\t\t\t<td style=\"background-color:LightYellow;\">Orange</td><td>3</td>\r\n\t\t</tr><tr>\r\n\t\t\t<td style=\"background-color:LightYellow;\">Pear</td><td>1</td>\r\n\t\t</tr>\r\n\t</table>\r\n</div>";
Helpers.ExtractAndCompareCodeFromHtml (result, originalHtml, "#A1");
}
void Default_Aspx_Descending_ProductName (string result, TestRunItem runItem)
{
string originalHtml = "<div>\r\n\t<table cellspacing=\"0\" rules=\"all\" border=\"1\" id=\"GridView1\" style=\"border-collapse:collapse;\">\r\n\t\t<tr>\r\n\t\t\t<th scope=\"col\" style=\"background-color:LightBlue;\"><a href=\"javascript:__doPostBack(&#39;GridView1&#39;,&#39;Sort$ProductName&#39;)\">Name</a></th><th scope=\"col\"><a href=\"javascript:__doPostBack(&#39;GridView1&#39;,&#39;Sort$ProductID&#39;)\">ID</a></th>\r\n\t\t</tr><tr>\r\n\t\t\t<td style=\"background-color:AliceBlue;\">Pear</td><td>1</td>\r\n\t\t</tr><tr>\r\n\t\t\t<td style=\"background-color:AliceBlue;\">Orange</td><td>3</td>\r\n\t\t</tr><tr>\r\n\t\t\t<td style=\"background-color:AliceBlue;\">Apple</td><td>2</td>\r\n\t\t</tr>\r\n\t</table>\r\n</div>";
Helpers.ExtractAndCompareCodeFromHtml (result, originalHtml, "#A1");
}
void Default_Aspx_Ascending_ProductID (string result, TestRunItem runItem)
{
string originalHtml = "<div>\r\n\t<table cellspacing=\"0\" rules=\"all\" border=\"1\" id=\"GridView1\" style=\"border-collapse:collapse;\">\r\n\t\t<tr>\r\n\t\t\t<th scope=\"col\"><a href=\"javascript:__doPostBack(&#39;GridView1&#39;,&#39;Sort$ProductName&#39;)\">Name</a></th><th scope=\"col\" style=\"background-color:Yellow;\"><a href=\"javascript:__doPostBack(&#39;GridView1&#39;,&#39;Sort$ProductID&#39;)\">ID</a></th>\r\n\t\t</tr><tr>\r\n\t\t\t<td>Pear</td><td style=\"background-color:LightYellow;\">1</td>\r\n\t\t</tr><tr>\r\n\t\t\t<td>Apple</td><td style=\"background-color:LightYellow;\">2</td>\r\n\t\t</tr><tr>\r\n\t\t\t<td>Orange</td><td style=\"background-color:LightYellow;\">3</td>\r\n\t\t</tr>\r\n\t</table>\r\n</div>";
Helpers.ExtractAndCompareCodeFromHtml (result, originalHtml, "#A1");
}
void Default_Aspx_Descending_ProductID (string result, TestRunItem runItem)
{
string originalHtml = "<div>\r\n\t<table cellspacing=\"0\" rules=\"all\" border=\"1\" id=\"GridView1\" style=\"border-collapse:collapse;\">\r\n\t\t<tr>\r\n\t\t\t<th scope=\"col\"><a href=\"javascript:__doPostBack(&#39;GridView1&#39;,&#39;Sort$ProductName&#39;)\">Name</a></th><th scope=\"col\" style=\"background-color:LightBlue;\"><a href=\"javascript:__doPostBack(&#39;GridView1&#39;,&#39;Sort$ProductID&#39;)\">ID</a></th>\r\n\t\t</tr><tr>\r\n\t\t\t<td>Orange</td><td style=\"background-color:AliceBlue;\">3</td>\r\n\t\t</tr><tr>\r\n\t\t\t<td>Apple</td><td style=\"background-color:AliceBlue;\">2</td>\r\n\t\t</tr><tr>\r\n\t\t\t<td>Pear</td><td style=\"background-color:AliceBlue;\">1</td>\r\n\t\t</tr>\r\n\t</table>\r\n</div>";
Helpers.ExtractAndCompareCodeFromHtml (result, originalHtml, "#A1");
}
}
}
#endif

View File

@@ -0,0 +1,118 @@
//
// Authors:
// Marek Habersack (mhabersack@novell.com)
//
// (C) 2010 Novell, Inc http://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.
//
using System;
using System.Collections.Generic;
using System.IO;
using System.Web;
using System.Web.Hosting;
using StandAloneRunnerSupport;
using StandAloneTests;
using NUnit.Framework;
namespace StandAloneTests.Locations
{
[TestCase ("Locations", "Configuration <location> tests.")]
public sealed class Locations : ITestCase
{
public string PhysicalPath {
get { return Path.Combine (Consts.BasePhysicalDir, "Locations"); }
}
public string VirtualPath {
get { return "/"; }
}
public bool SetUp (List <TestRunItem> runItems)
{
runItems.Add (new TestRunItem ("Default.aspx", Default_Aspx));
runItems.Add (new TestRunItem ("Stuff.aspx", Stuff_Aspx));
runItems.Add (new TestRunItem ("sub/Default.aspx", Sub_Default_Aspx));
runItems.Add (new TestRunItem ("sub/Stuff.aspx", Sub_Stuff_Aspx));
runItems.Add (new TestRunItem ("sub/sub/Default.aspx", Sub_Sub_Default_Aspx));
runItems.Add (new TestRunItem ("sub/sub/Stuff.aspx", Sub_Sub_Stuff_Aspx));
return true;
}
void Default_Aspx (string result, TestRunItem runItem)
{
string originalHtml = "/Hello";
Helpers.ExtractAndCompareCodeFromHtml (result, originalHtml, "#A1");
}
void Stuff_Aspx (string result, TestRunItem runItem)
{
string originalHtml = @"<pre id=""settings""> /Web.config [1]: '[toplevel]'
/Web.config [2]: 'Stuff.aspx'
</pre>";
Helpers.ExtractAndCompareCodeFromHtml (result, originalHtml, "#A1");
}
void Sub_Default_Aspx (string result, TestRunItem runItem)
{
string originalHtml = "/sub/Hello";
Helpers.ExtractAndCompareCodeFromHtml (result, originalHtml, "#A1");
}
void Sub_Stuff_Aspx (string result, TestRunItem runItem)
{
string originalHtml = @"<pre id=""settings""> /Web.config [1]: '[toplevel]'
/Web.config [3]: 'sub'
/sub/Web.config [1]: '[toplevel]'
/Web.config [4]: 'sub/Stuff.aspx'
/sub/Web.config [2]: 'Stuff.aspx'
</pre>";
Helpers.ExtractAndCompareCodeFromHtml (result, originalHtml, "#A1");
}
void Sub_Sub_Default_Aspx (string result, TestRunItem runItem)
{
string originalHtml = "/sub/sub/Hello";
Helpers.ExtractAndCompareCodeFromHtml (result, originalHtml, "#A1");
}
void Sub_Sub_Stuff_Aspx (string result, TestRunItem runItem)
{
string originalHtml = @"<pre id=""settings""> /Web.config [1]: '[toplevel]'
/Web.config [3]: 'sub'
/sub/Web.config [1]: '[toplevel]'
/Web.config [6]: 'sub/sub'
/sub/Web.config [4]: 'sub'
/sub/sub/Web.config [1]: '[toplevel]'
/Web.config [5]: 'sub/sub/Stuff.aspx'
/sub/Web.config [3]: 'sub/Stuff.aspx'
/sub/sub/Web.config [2]: 'Stuff.aspx'
</pre>";
Helpers.ExtractAndCompareCodeFromHtml (result, originalHtml, "#A1");
}
}
}

View File

@@ -0,0 +1,75 @@
//
// Authors:
// Marek Habersack (mhabersack@novell.com)
//
// (C) 2010 Novell, Inc http://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.
//
using System;
using System.Collections.Generic;
using System.IO;
using System.Web.Util;
using StandAloneRunnerSupport;
using StandAloneTests;
using NUnit.Framework;
namespace StandAloneTests.MD5PasswordAuth_Bug601727
{
[TestCase ("MD5PasswordAuth_Bug601727", "Hashed passwords should be compared case-insensitively")]
public sealed class Test_01 : ITestCase
{
public string PhysicalPath {
get { return Path.Combine (Consts.BasePhysicalDir, "MD5PasswordAuth_Bug601727"); }
}
public string VirtualPath {
get { return "/"; }
}
public bool SetUp (List <TestRunItem> runItems)
{
runItems.Add (new TestRunItem ("login.aspx", null));
runItems.Add (new TestRunItem ("login.aspx", LoggedIn_Aspx) {
PostValues = new string[] {
"__EVENTTARGET", String.Empty,
"__EVENTARGUMENT", String.Empty,
"loginControl$LoginButton", "Log In",
"loginControl$Password", "test",
"loginControl$UserName", "admin"
},
UrlDescription = "Login postback"
}
);
return true;
}
void LoggedIn_Aspx (string result, TestRunItem runItem)
{
Assert.IsTrue (runItem.Redirected, "#A1");
Assert.AreEqual ("/default.aspx", runItem.RedirectLocation, "#A2");
}
}
}

View File

@@ -0,0 +1,65 @@
//
// Authors:
// Marek Habersack (mhabersack@novell.com)
//
// (C) 2010 Novell, Inc http://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_4_0
using System;
using System.Collections.Generic;
using System.IO;
using System.Web.Util;
using StandAloneRunnerSupport;
using StandAloneTests;
using NUnit.Framework;
namespace StandAloneTests.Menu_40_List
{
[TestCase ("Menu_40_List", "Menu control List rendering mode for 4.0", Disabled=true)]
public sealed class Test_01 : ITestCase
{
public string PhysicalPath {
get { return Path.Combine (Consts.BasePhysicalDir, "Menu_4.0_List"); }
}
public string VirtualPath {
get { return "/"; }
}
public bool SetUp (List <TestRunItem> runItems)
{
runItems.Add (new TestRunItem ("test_01.aspx", Test_01_Aspx));
return true;
}
void Test_01_Aspx (string result, TestRunItem runItem)
{
string originalHtml = "<a href=\"#MyMenu1_SkipLink\"><img alt=\"Skip Navigation Links\" src=\"/WebResource.axd\" width=\"0\" height=\"0\" style=\"border-width:0px;\" /></a><div id=\"MyMenu1\">\r\n\t<ul class=\"level1\">\r\n\t\t<li><a title=\"Root description\" class=\"popout level1\" href=\"./\">Root</a><ul class=\"level2\">\r\n\t\t\t<li><a title=\"Mono Project Home Page\" class=\"popout level2\" href=\"http://mono-project.com/\">Mono</a><ul class=\"level3\">\r\n\t\t\t\t<li><a title=\"How to report Mono bugs\" class=\"popout level3\" href=\"http://mono-project.com/Bugs\">Mono Bugs</a><ul class=\"level4\">\r\n\t\t\t\t\t<li><a title=\"Includes Mono bugs interface\" class=\"level4\" href=\"http://bugzilla.novell.com\">Novell Bugzilla</a></li>\r\n\t\t\t\t</ul></li>\r\n\t\t\t</ul></li><li><a title=\"Main page of the Google search engine\" class=\"popout level2\" href=\"http://google.com\">Google</a><ul class=\"level3\">\r\n\t\t\t\t<li><a title=\"Google language translation interface\" class=\"level3\" href=\"http://translate.google.com\">Translator</a></li><li><a title=\"Google code search engine\" class=\"level3\" href=\"http://google.com/codesearch\">Code Search</a></li>\r\n\t\t\t</ul></li>\r\n\t\t</ul></li>\r\n\t</ul>\r\n</div><a id=\"MyMenu1_SkipLink\"></a>";
Helpers.ExtractAndCompareCodeFromHtml (Helpers.StripWebResourceAxdQuery (result), originalHtml, "#A1");
}
}
}
#endif

View File

@@ -0,0 +1,166 @@
//
// Authors:
// Marek Habersack (mhabersack@novell.com)
//
// (C) 2010 Novell, Inc http://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_4_0
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Configuration.Provider;
using System.IO;
using System.Web;
using System.Web.Hosting;
using StandAloneRunnerSupport;
using StandAloneTests;
using NUnit.Framework;
namespace StandAloneTests.OutputCacheProvider
{
[TestCase ("OutputCacheProvider 01", "OutputCacheProvider - custom provider test")]
public sealed class OutputCacheProvider_01 : ITestCase
{
public string PhysicalPath {
get {
return Path.Combine (
Consts.BasePhysicalDir,
Path.Combine ("OutputCacheProvider", "OutputCacheProviderTest_01")
);
}
}
public string VirtualPath {
get { return "/"; }
}
public bool SetUp (List <TestRunItem> runItems)
{
runItems.Add (new TestRunItem ("/Default.aspx", Default_Aspx));
return true;
}
void Default_Aspx (string result, TestRunItem runItem)
{
string originalHtml = @"<pre id=""output"">Default provider name: TestInMemoryProvider
Null context: TestInMemoryProvider
Default context: TestInMemoryProvider
</pre>";
Helpers.ExtractAndCompareCodeFromHtml (result, originalHtml, "#A1");
}
}
[TestCase ("OutputCacheProvider 02", "OutputCacheProvider - missing provider test")]
public sealed class OutputCacheProvider_02 : ITestCase
{
public string PhysicalPath {
get {
return Path.Combine (
Consts.BasePhysicalDir,
Path.Combine ("OutputCacheProvider", "OutputCacheProviderTest_02")
);
}
}
public string VirtualPath {
get { return "/"; }
}
public bool SetUp (List <TestRunItem> runItems)
{
runItems.Add (new TestRunItem ("/Default.aspx", Default_Aspx));
return true;
}
void Default_Aspx (string result, TestRunItem runItem)
{
Assert.IsTrue (Helpers.HasException (result, typeof (ConfigurationErrorsException)), "#A1");
}
}
[TestCase ("OutputCacheProvider 03", "OutputCacheProvider - per request provider test")]
public sealed class OutputCacheProvider_03 : ITestCase
{
public string PhysicalPath {
get {
return Path.Combine (
Consts.BasePhysicalDir,
Path.Combine ("OutputCacheProvider", "OutputCacheProviderTest_03")
);
}
}
public string VirtualPath {
get { return "/"; }
}
public bool SetUp (List <TestRunItem> runItems)
{
runItems.Add (new TestRunItem ("/Default.aspx", Default_Aspx));
runItems.Add (new TestRunItem ("/Default.aspx?ocp=InMemory", Default_InMemory_Aspx));
runItems.Add (new TestRunItem ("/Default.aspx?ocp=AnotherInMemory", Default_AnotherInMemory_Aspx));
runItems.Add (new TestRunItem ("/Default.aspx?ocp=invalid", Default_Invalid_Aspx));
return true;
}
void Default_Aspx (string result, TestRunItem runItem)
{
string originalHtml = @"<pre id=""output"">Default provider name: AspNetInternalProvider
Default context: AspNetInternalProvider
</pre>";
Helpers.ExtractAndCompareCodeFromHtml (result, originalHtml, "#A1");
}
void Default_InMemory_Aspx (string result, TestRunItem runItem)
{
string originalHtml = @"<pre id=""output"">Default provider name: AspNetInternalProvider
Default context: TestInMemoryProvider
</pre>";
Helpers.ExtractAndCompareCodeFromHtml (result, originalHtml, "#A1");
}
void Default_AnotherInMemory_Aspx (string result, TestRunItem runItem)
{
string originalHtml = @"<pre id=""output"">Default provider name: AspNetInternalProvider
Default context: TestAnotherInMemoryProvider
</pre>";
Helpers.ExtractAndCompareCodeFromHtml (result, originalHtml, "#A1");
}
void Default_Invalid_Aspx (string result, TestRunItem runItem)
{
Assert.IsTrue (Helpers.HasException (result, typeof (ProviderException)), "#A1");
}
}
}
#endif

View File

@@ -0,0 +1,67 @@
//
// Authors:
// Marek Habersack (mhabersack@novell.com)
//
// (C) 2010 Novell, Inc http://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_4_0
using System;
using System.Collections.Generic;
using System.IO;
using System.Web;
using System.Web.Hosting;
using StandAloneRunnerSupport;
using StandAloneTests;
using NUnit.Framework;
namespace StandAloneTests.PageMetaAttributes
{
[TestCase ("PageMetaAttributes", "Tests for Page.Meta{Description,Keywords} properties/attributes")]
public sealed class PageMetaAttributes : ITestCase
{
public string PhysicalPath {
get { return Path.Combine (Consts.BasePhysicalDir, "PageMetaAttributes"); }
}
public string VirtualPath {
get { return "/"; }
}
public bool SetUp (List <TestRunItem> runItems)
{
runItems.Add (new TestRunItem ("/Default.aspx", Default_Aspx));
return true;
}
void Default_Aspx (string result, TestRunItem runItem)
{
string originalHtml = "<head><title>\r\n Test\r\n</title><meta name=\"description\" content=\"This is meta description\" /><meta name=\"keywords\" content=\"meta,keywords,here\" /></head>";
Helpers.ExtractAndCompareCodeFromHtml (result, originalHtml, "#A1");
}
}
}
#endif

View File

@@ -0,0 +1,127 @@
//
// Authors:
// Marek Habersack (mhabersack@novell.com)
//
// (C) 2010 Novell, Inc http://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_4_0
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Configuration.Provider;
using System.IO;
using System.Web;
using System.Web.Hosting;
using StandAloneRunnerSupport;
using StandAloneTests;
using NUnit.Framework;
namespace StandAloneTests.PageParserDefaultTypeProperties
{
[TestCase ("PageParserDefaultTypeProperties 01", "Tests for PageParser.Default*Type properties")]
public sealed class PageParserDefaultTypeProperties_01 : ITestCase
{
static string[] expectedMessages_1 = {
"1: DefaultApplicationBaseType: set",
"1: DefaultPageBaseType: set",
"1: DefaultPageParserFilterType: set",
"1: DefaultUserControlBaseType: set"
};
static string[] expectedMessages_2 = {
"2: DefaultApplicationBaseType: exception 'System.ArgumentException' thrown.",
"2: DefaultPageBaseType: exception 'System.ArgumentException' thrown.",
"2: DefaultPageParserFilterType: exception 'System.ArgumentException' thrown.",
"2: DefaultUserControlBaseType: exception 'System.ArgumentException' thrown."
};
static string[] expectedMessages_3 = {
"3: DefaultApplicationBaseType: set",
"3: DefaultPageBaseType: set",
"3: DefaultPageParserFilterType: set",
"3: DefaultUserControlBaseType: set"
};
public string PhysicalPath {
get {
return Path.Combine (Consts.BasePhysicalDir, "PageParserDefaultTypeProperties");
}
}
public string VirtualPath {
get { return "/"; }
}
public bool SetUp (List <TestRunItem> runItems)
{
runItems.Add (
new TestRunItem ("/default.aspx", "Set correct values", Default_Aspx_1) {
AppDomainData = new object[] { "TestNumber", 1 }
}
);
runItems.Add (
new TestRunItem ("/default.aspx", "Set invalid values", Default_Aspx_2) {
AppDomainData = new object[] { "TestNumber", 2 }
}
);
runItems.Add (
new TestRunItem ("/default.aspx", "Set null values", Default_Aspx_3) {
AppDomainData = new object[] { "TestNumber", 3 }
}
);
return true;
}
void Default_Aspx_1 (string result, TestRunItem runItem)
{
CheckResults (runItem.TestRunData as List <string>, expectedMessages_1);
}
void Default_Aspx_2 (string result, TestRunItem runItem)
{
CheckResults (runItem.TestRunData as List <string>, expectedMessages_2);
}
void Default_Aspx_3 (string result, TestRunItem runItem)
{
CheckResults (runItem.TestRunData as List <string>, expectedMessages_3);
}
void CheckResults (List <string> messages, string[] expectedMessages)
{
Assert.IsNotNull (messages, "#A1");
int len = messages.Count;
if (expectedMessages.Length != len)
Assert.Fail ("Expected {0} messages, found {1}", expectedMessages.Length, len);
for (int i = 0; i < len; i++)
Assert.AreEqual (expectedMessages [i], messages [i], "#A2-" + i.ToString ());
}
}
}
#endif

View File

@@ -0,0 +1,87 @@
//
// Authors:
// Marek Habersack (mhabersack@novell.com)
//
// (C) 2010 Novell, Inc http://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_4_0
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Configuration.Provider;
using System.IO;
using System.Web;
using System.Web.Hosting;
using StandAloneRunnerSupport;
using StandAloneTests;
using NUnit.Framework;
namespace StandAloneTests.RegisterBuildProvider
{
[TestCase ("RegisterBuildProvider 01", "Tests for BuildProvider.RegisterBuildProvider")]
public sealed class RegisterBuildProvider_01 : ITestCase
{
static string[] expectedMessages = {
"RegisterFooBuildProvider called",
"Registering typeof (string) failed (ArgumentException)",
"Registering typeof (BuildProvider) succeeded.",
"Registering typeof (FooBuildProvider) succeeded.",
"RegisterBuildProvider.Test.FooBuildProvider.GenerateCode called"
};
public string PhysicalPath {
get {
return Path.Combine (Consts.BasePhysicalDir, "RegisterBuildProvider");
}
}
public string VirtualPath {
get { return "/"; }
}
public bool SetUp (List <TestRunItem> runItems)
{
runItems.Add (new TestRunItem ("/default.aspx", Default_Aspx));
return true;
}
void Default_Aspx (string result, TestRunItem runItem)
{
var messages = runItem.TestRunData as List <string>;
Assert.IsNotNull (messages, "#A1");
int len = messages.Count;
if (expectedMessages.Length != len)
Assert.Fail ("Expected {0} messages, found {1}", expectedMessages.Length, len);
for (int i = 0; i < len; i++)
Assert.AreEqual (expectedMessages [i], messages [i], "#A2-" + i.ToString ());
}
}
}
#endif

View File

@@ -0,0 +1,210 @@
//
// Authors:
// Marek Habersack (mhabersack@novell.com)
//
// (C) 2010 Novell, Inc http://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_4_0
using System;
using System.Collections.Generic;
using System.IO;
using System.Web.Util;
using StandAloneRunnerSupport;
using StandAloneTests;
using NUnit.Framework;
using StandAloneTests.RequestValidator.Generated;
namespace StandAloneTests.RequestValidator
{
class RequestValidatorCallSet
{
List <Dictionary <string, object>> callSets;
public List <Dictionary <string, object>> CallSets {
get {
if (callSets == null)
callSets = new List <Dictionary <string, object>> ();
return callSets;
}
}
public string Name {
get;
protected set;
}
protected void RegisterCallSet (Dictionary <string, object> callSet)
{
if (callSet == null || callSet.Count == 0)
return;
CallSets.Add (callSet);
}
public bool ContainsCallSet (Dictionary <string, object> callSet)
{
foreach (var dict in CallSets)
if (DictionariesEqual (dict, callSet))
return true;
return false;
}
bool DictionariesEqual (Dictionary <string, object> first, Dictionary <string, object> second)
{
if (first == null ^ second == null)
return false;
if (first.Count != second.Count)
return false;
object left, right;
foreach (string s in first.Keys) {
if (s == "calledFrom")
continue;
if (!second.TryGetValue (s, out left))
return false;
right = first [s];
if (left == null ^ right == null)
return false;
if (left == null)
continue;
if (!left.Equals (right))
return false;
}
return true;
}
}
static class RequestValidatorCallSetContainer
{
public static List <RequestValidatorCallSet> CallSets {
get;
private set;
}
static RequestValidatorCallSetContainer ()
{
CallSets = new List <RequestValidatorCallSet> ();
}
public static RequestValidatorCallSet GetCallSet (string name)
{
foreach (RequestValidatorCallSet cs in CallSets)
if (String.Compare (cs.Name, name, StringComparison.Ordinal) == 0)
return cs;
return null;
}
public static void Register (RequestValidatorCallSet callSet)
{
CallSets.Add (callSet);
}
}
[TestCase ("RequestValidator", "4.0 extensible request validation tests.")]
public sealed class RequestValidatorTests : ITestCase
{
public string PhysicalPath {
get { return Path.Combine (Consts.BasePhysicalDir, "RequestValidator"); }
}
public string VirtualPath {
get { return "/"; }
}
public bool SetUp (List <TestRunItem> runItems)
{
GeneratedCallSets.Register ();
runItems.Add (new TestRunItem ("Default.aspx", Default_Aspx));
runItems.Add (new TestRunItem ("Default.aspx?key=invalid<script>value</script>", Default_Aspx_Script));
return true;
}
string SummarizeCallSet (Dictionary <string, object> callSet)
{
return String.Format (@" URL: {0}
Context present: {1}
Value: {2}
Request validation source: {3}
Collection key: {4}
Validation failure index: {5}
Return value: {6}
",
callSet ["rawUrl"],
callSet ["context"],
callSet ["value"],
(int)callSet ["requestValidationSource"],
callSet ["collectionKey"],
callSet ["validationFailureIndex"],
callSet ["returnValue"]);
}
void Default_Aspx (string result, TestRunItem runItem)
{
if (runItem == null)
throw new ArgumentNullException ("runItem");
CompareCallSets (runItem, "000");
}
void Default_Aspx_Script (string result, TestRunItem runItem)
{
if (runItem == null)
throw new ArgumentNullException ("runItem");
CompareCallSets (runItem, "001");
}
void CompareCallSets (TestRunItem runItem, string name)
{
var dict = runItem.TestRunData as List <Dictionary <string, object>>;
if (dict == null || dict.Count == 0)
Assert.Fail ("No call data recorded.");
RequestValidatorCallSet cs = RequestValidatorCallSetContainer.GetCallSet (name);
if (cs == null)
Assert.Fail ("Call set \"{0}\" not found.", name);
foreach (Dictionary <string, object> calls in dict) {
if (!cs.ContainsCallSet (calls))
Assert.Fail ("{0}: call sequence not found:{1}{2}", name, Environment.NewLine, SummarizeCallSet (calls));
}
}
}
}
#endif

File diff suppressed because one or more lines are too long

Some files were not shown because too many files have changed in this diff Show More