From b678ea18b238ef1ab816445f48bd1c838f9978fc Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Mon, 30 Apr 2012 18:44:22 +0100
Subject: Create TestHelpers.EnableLogging() and DisableLogging() to turn
logging on and off within tests.
This makes *.Tests.dll.config files no longer needed, hence deleted.
---
.../Region/Framework/Scenes/Tests/BorderTests.cs | 4 +-
.../Framework/Scenes/Tests/SceneGraphTests.cs | 6 +++
.../Scenes/Tests/ScenePresenceTeleportTests.cs | 3 +-
OpenSim/Tests/Common/TestHelpers.cs | 46 ++++++++++++++++++++++
4 files changed, 55 insertions(+), 4 deletions(-)
(limited to 'OpenSim')
diff --git a/OpenSim/Region/Framework/Scenes/Tests/BorderTests.cs b/OpenSim/Region/Framework/Scenes/Tests/BorderTests.cs
index ab6311b..4a21dc9 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/BorderTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/BorderTests.cs
@@ -27,6 +27,7 @@
using System;
using System.Collections.Generic;
+using System.IO;
using System.Text;
using NUnit.Framework;
using OpenMetaverse;
@@ -68,11 +69,8 @@ namespace OpenSim.Region.Framework.Scenes.Tests
Vector3 position = new Vector3(200,200,21);
foreach (Border b in testborders)
- {
Assert.That(!b.TestCross(position));
- }
-
position = new Vector3(200,280,21);
Assert.That(NorthBorder.TestCross(position));
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneGraphTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneGraphTests.cs
index 1c33a5f..d23c965 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/SceneGraphTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/SceneGraphTests.cs
@@ -26,7 +26,9 @@
*/
using System;
+using System.IO;
using System.Reflection;
+using System.Text;
using NUnit.Framework;
using OpenMetaverse;
using OpenSim.Framework;
@@ -44,6 +46,8 @@ namespace OpenSim.Region.Framework.Scenes.Tests
public void TestDuplicateObject()
{
TestHelpers.InMethod();
+// TestHelpers.EnableLogging();
+
Scene scene = new SceneHelpers().SetupScene();
UUID ownerId = new UUID("00000000-0000-0000-0000-000000000010");
@@ -82,6 +86,8 @@ namespace OpenSim.Region.Framework.Scenes.Tests
Assert.That(dupePart1.PhysActor, Is.Not.Null);
Assert.That(dupePart2.PhysActor, Is.Not.Null);
*/
+
+// TestHelpers.DisableLogging();
}
}
}
\ No newline at end of file
diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs
index 19542ff..c750cc5 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs
@@ -38,7 +38,8 @@ using OpenSim.Region.Framework.Interfaces;
using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation;
using OpenSim.Tests.Common;
using OpenSim.Tests.Common.Mock;
-using System.Threading;
+using System.IO;
+using System.Text;
namespace OpenSim.Region.Framework.Scenes.Tests
{
diff --git a/OpenSim/Tests/Common/TestHelpers.cs b/OpenSim/Tests/Common/TestHelpers.cs
index ced06de..5030d4b 100644
--- a/OpenSim/Tests/Common/TestHelpers.cs
+++ b/OpenSim/Tests/Common/TestHelpers.cs
@@ -27,6 +27,8 @@
using System;
using System.Diagnostics;
+using System.IO;
+using System.Text;
using NUnit.Framework;
using OpenMetaverse;
@@ -34,6 +36,37 @@ namespace OpenSim.Tests.Common
{
public class TestHelpers
{
+ private static Stream EnableLoggingConfigStream
+ = new MemoryStream(
+ Encoding.UTF8.GetBytes(
+@"
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+"));
+
+ private static Stream DisableLoggingConfigStream
+ = new MemoryStream(
+ Encoding.UTF8.GetBytes(
+ // "")));
+ //"")));
+ //"")));
+ //"")));
+ //"")));
+ ""));
+
public static bool AssertThisDelegateCausesArgumentException(TestDelegate d)
{
try
@@ -58,6 +91,19 @@ namespace OpenSim.Tests.Common
Console.WriteLine("===> In Test Method : {0} <===", stackTrace.GetFrame(1).GetMethod().Name);
}
+ public static void EnableLogging()
+ {
+ log4net.Config.XmlConfigurator.Configure(EnableLoggingConfigStream);
+ }
+
+ ///
+ /// Disable logging whilst running the tests.
+ ///
+ public static void DisableLogging()
+ {
+ log4net.Config.XmlConfigurator.Configure(DisableLoggingConfigStream);
+ }
+
///
/// Parse tail section into full UUID.
///
--
cgit v1.1