CassiniDevBrowserTestFixture.cs 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Collections.Specialized;
  4. using System.Diagnostics;
  5. using System.IO;
  6. using System.Linq;
  7. using System.Net;
  8. using System.Text;
  9. using System.Threading;
  10. using CassiniDev.ServerLog;
  11. using Microsoft.Win32;
  12. using NUnit.Framework;
  13. namespace CassiniDev.NUnitFixtures.Tests
  14. {
  15. [TestFixture]
  16. public class CassiniDevBrowserTestFixture
  17. {
  18. /// <summary>
  19. /// Want to let a javascript unit test page post it's results to a non-existent handler
  20. /// so we can catch the post data in RequestComplete
  21. /// </summary>
  22. [Test]
  23. public void TestIE()
  24. {
  25. const string applicationPath = @"..\..\..\..\CassiniDev.TestSite";
  26. var test = new CassiniDevBrowserTest();
  27. test.StartServer(Path.GetFullPath(applicationPath));
  28. var uri = test.NormalizeUrl("qunit-callback.htm");
  29. RequestEventArgs result = test.RunTest(uri, WebBrowser.InternetExplorer);
  30. var body = Encoding.UTF8.GetString(result.RequestLog.Body);
  31. test.StopServer();
  32. }
  33. /// <summary>
  34. /// Want to let a javascript unit test page post it's results to a non-existent handler
  35. /// so we can catch the post data in RequestComplete
  36. /// </summary>
  37. [Test]
  38. public void TestFF()
  39. {
  40. const string applicationPath = @"..\..\..\..\CassiniDev.TestSite";
  41. var test = new CassiniDevBrowserTest();
  42. test.StartServer(Path.GetFullPath(applicationPath));
  43. var uri = test.NormalizeUrl("qunit-callback.htm");
  44. RequestEventArgs result = test.RunTest(uri, WebBrowser.Firefox);
  45. var body = Encoding.UTF8.GetString(result.RequestLog.Body);
  46. test.StopServer();
  47. }
  48. /// <summary>
  49. /// Want to let a javascript unit test page post it's results to a non-existent handler
  50. /// so we can catch the post data in RequestComplete
  51. /// </summary>
  52. [Test]
  53. public void TestChrome()
  54. {
  55. const string applicationPath = @"..\..\..\..\CassiniDev.TestSite";
  56. var test = new CassiniDevBrowserTest();
  57. test.StartServer(Path.GetFullPath(applicationPath));
  58. var uri = test.NormalizeUrl("qunit-callback.htm");
  59. RequestEventArgs result = test.RunTest(uri, WebBrowser.Chrome);
  60. var body = Encoding.UTF8.GetString(result.RequestLog.Body);
  61. test.StopServer();
  62. }
  63. }
  64. }