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.
---
OpenSim/Tests/Common/TestHelpers.cs | 46 +++++++++++++++++++++++++++++++++++++
1 file changed, 46 insertions(+)
(limited to 'OpenSim/Tests/Common')
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