Author: rolf
Date: 2007-01-15 04:14:21 -0500 (Mon, 15 Jan 2007)
New Revision: 71009
Added:
Log:
2007-01-15 Rolf Bjarne Kvinge <RKvinge (AT) novell (DOT) com>
* AspLogTest.cs, FileLogTraceListener.cs, LogTest.cs
Added:
2007-01-15 09:13:19 UTC (rev 71008)
2007-01-15 09:14:21 UTC (rev 71009)
@@ -0,0 +1,54 @@
+// AspLogTest.cs - NUnit Test Cases for
+//
+// Rolf Bjarne Kvinge (RKvinge (AT) novell (DOT) com)
+//
+//
+// Copyright (C) 2007 Novell, Inc (http://www.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 SFTWARE IS PRVIDED "AS IS", WITHUT WARRANTY F ANY KIND,
+// EXPRESS R IMPLIED, INCLUDING BUT NT LIMITED T THE WARRANTIES F
+// MERCHANTABILITY, FITNESS FR A PARTICULAR PURPSE AND
+// NNINFRINGEMENT. IN N EVENT SHALL THE AUTHRS R CPYRIGHT HLDERS BE
+// LIABLE FR ANY CLAIM, DAMAGES R THER LIABILITY, WHETHER IN AN ACTIN
+// F CNTRACT, TRT R THERWISE, ARISING FRM, UT F R IN CNNECTIN
+// WITH THE SFTWARE R THE USE R THER DEALINGS IN THE SFTWARE.
+//
+#if NET_2_0
+using System;
+using System.Collections.Generic;
+using System.Text;
+using NUnit.Framework;
+using Microsoft.VisualBasic.Logging;
+
+namespace
+{
+[TestFixture]
+public class AspLogTest
+{
+[Test]
+public void TestDefaults ()
+{
+AspLog log = new AspLog ();
+Assert.IsNull (log.DefaultFileLogWriter, "#01");
+Assert.AreEqual ("DefaultSource", log.TraceSource.Name, "#02");
+Assert.AreEqual (2, , "#03");
+Assert.AreEqual ("Default", H<(log.TraceSource.Listeners) [0].Name, "#04");
+Assert.AreEqual ("", H<(log.TraceSource.Listeners) [1].Name, "#05");
+Assert.AreEqual ("DefaultTraceListener", H<(log.TraceSource.Listeners) [0].GetType ().Name, "#06");
+Assert.AreEqual ("WebPageTraceListener", H<(log.TraceSource.Listeners) [1].GetType ().Name, "#07");
+Assert.AreEqual (, log.TraceSource.Switch.Level, "#08");
+}
+}
+}
+#endif
\ No newline at end of file
Added:
2007-01-15 09:13:19 UTC (rev 71008)
2007-01-15 09:14:21 UTC (rev 71009)
@@ -0,0 +1,3 @@
+2007-01-15 Rolf Bjarne Kvinge <RKvinge (AT) novell (DOT) com>
+
+* AspLogTest.cs, FileLogTraceListener.cs, LogTest.cs
\ No newline at end of file
Added:
2007-01-15 09:13:19 UTC (rev 71008)
2007-01-15 09:14:21 UTC (rev 71009)
@@ -0,0 +1,346 @@
+// FileLogTraceListenerTest.cs - NUnit Test Cases for
+//
+// Rolf Bjarne Kvinge (RKvinge (AT) novell (DOT) com)
+//
+//
+// Copyright (C) 2007 Novell, Inc (http://www.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 SFTWARE IS PRVIDED "AS IS", WITHUT WARRANTY F ANY KIND,
+// EXPRESS R IMPLIED, INCLUDING BUT NT LIMITED T THE WARRANTIES F
+// MERCHANTABILITY, FITNESS FR A PARTICULAR PURPSE AND
+// NNINFRINGEMENT. IN N EVENT SHALL THE AUTHRS R CPYRIGHT HLDERS BE
+// LIABLE FR ANY CLAIM, DAMAGES R THER LIABILITY, WHETHER IN AN ACTIN
+// F CNTRACT, TRT R THERWISE, ARISING FRM, UT F R IN CNNECTIN
+// WITH THE SFTWARE R THE USE R THER DEALINGS IN THE SFTWARE.
+//
+#if NET_2_0
+using System;
+using System.Collections.Generic;
+using System.Text;
+using NUnit.Framework;
+using Microsoft.VisualBasic.Logging;
+using System.Globalization;
+
+namespace
+{
+[TestFixture]
+public class FileLogTraceListenerTest
+{
+[Test]
+public void SupportedAttributesTest ()
+{
+Derived derived = new Derived ();
+Assert.AreEqual ( (derived.GetAttribs (), ";"), "append;Append;autoflush;AutoFlush;autoFlush;basefi lename;BaseFilename;baseFilename;BaseFileName;base FileName;customlocation;CustomLocation;customLocat ion;delimiter;Delimiter;diskspaceexhaustedbehavior ;DiskSpaceExhaustedBehavior;diskSpaceExhaustedBeha vior;encoding;Encoding;includehostname;IncludeHost Name;includeHostName;location;Location;logfilecrea tionschedule;LogFileCreationSchedule;logFileCreati onSchedule;maxfilesize;MaxFileSize;maxFileSize;res ervediskspace;ReserveDiskSpace;reserveDiskSpace", "#01");
+}
+
+[Test]
+public void DefaultPropertiesTest ()
+{
+using (FileLogTraceListener log = new FileLogTraceListener ()) {
+Assert.AreEqual (true, log.Append, "A1");
+Assert.AreEqual (false, log.AutoFlush, "A2");
+Assert.AreEqual ((), log.BaseFileName, "B1");
+Assert.AreEqual (, log.CustomLocation, "C1");
+Assert.AreEqual ("\t", log.Delimiter, "D1");
+Assert.AreEqual (DiskSpaceEDiscardMessages, log.DiskSpaceExhaustedBehavior, "D2");
+Assert.AreEqual (, log.Encoding.EncodingName, "E1");
+Assert.AreEqual (System.IPath.Combine(, log.BaseFileName) + ".log", log.FullLogFileName, "F1");
+Assert.IsNull(log.Filter, "F2");
+Assert.AreEqual (false, log.IncludeHostName, "I1");
+Assert.AreEqual (, log.Location, "L1");
+Assert.AreEqual (LogFileCreationSNone, log.LogFileCreationSchedule, "L2");
+Assert.AreEqual (5000000, log.MaxFileSize, "M1");
+Assert.AreEqual ("FileLogTraceListener", log.Name, "N1");
+Assert.AreEqual (10000000, log.ReserveDiskSpace, "R1");
+}
+}
+
+[Test]
+public void FilenameTest ()
+{
+using (FileLogTraceListener log = new FileLogTraceListener ()) {
+log.LogFileCreationSchedule = LogFileCreationSNone;
+log.Location = ;
+Assert.AreEqual (System.IPath.Combine(, log.BaseFileName) + ".log", log.FullLogFileName, "#A1");
+
+log.Location = ;
+Assert.AreEqual (System.IPath.Combine (System.IPath.GetDirectoryName(), log.BaseFileName) + ".log", log.FullLogFileName, "#A2");
+
+log.Location = ;
+Assert.AreEqual (System.IPath.Combine (, log.BaseFileName) + ".log", log.FullLogFileName, "#A3");
+
+log.Location = LogFileLocation.TempDirectory;
+Assert.AreEqual (System.IPath.Combine (, log.BaseFileName) + ".log", log.FullLogFileName, "#A4");
+
+log.Location = LogFileLocation.Custom;
+Assert.AreEqual (System.IPath.Combine (, log.BaseFileName) + ".log", log.FullLogFileName, "#A5");
+
+log.CustomLocation = ;
+Assert.AreEqual (System.IPath.Combine (, log.BaseFileName) + ".log", log.FullLogFileName, "#A6");
+}
+
+using (FileLogTraceListener log = new FileLogTraceListener ()) {
+log.LogFileCreationSchedule = LogFileCreationSDaily;
+log.Location = ;
+Assert.AreEqual (System.IPath.Combine (, log.BaseFileName) + DateTime.Now.ToString("-yyyy-MM-dd") + ".log", log.FullLogFileName, "#B1");
+
+log.Location = ;
+Assert.AreEqual (System.IPath.Combine (System.IPath.GetDirectoryName (), log.BaseFileName) + DateTime.Now.ToString ("-yyyy-MM-dd") + ".log", log.FullLogFileName, "#B2");
+
+log.Location = ;
+Assert.AreEqual (System.IPath.Combine (, log.BaseFileName) + DateTime.Now.ToString ("-yyyy-MM-dd") + ".log", log.FullLogFileName, "#B3");
+
+log.Location = LogFileLocation.TempDirectory;
+Assert.AreEqual (System.IPath.Combine (, log.BaseFileName) + DateTime.Now.ToString ("-yyyy-MM-dd") + ".log", log.FullLogFileName, "#B4");
+
+log.Location = LogFileLocation.Custom;
+Assert.AreEqual (System.IPath.Combine (, log.BaseFileName) + DateTime.Now.ToString ("-yyyy-MM-dd") + ".log", log.FullLogFileName, "#B5");
+
+log.CustomLocation = ;
+Assert.AreEqual (System.IPath.Combine (, log.BaseFileName) + DateTime.Now.ToString ("-yyyy-MM-dd") + ".log", log.FullLogFileName, "#B6");
+}
+
+using (FileLogTraceListener log = new FileLogTraceListener ()) {
+DateTime dt = DateTime.Today.AddDays (-(int)DateTime.Today.DWeek);
+string format = dt.ToString ("-yyyy-MM-dd");
+log.LogFileCreationSchedule = LogFileCreationSWeekly;
+log.Location = ;
+Assert.AreEqual (System.IPath.Combine (, log.BaseFileName) + format + ".log", log.FullLogFileName, "#C1");
+
+log.Location = ;
+Assert.AreEqual (System.IPath.Combine (System.IPath.GetDirectoryName (), log.BaseFileName) + format + ".log", log.FullLogFileName, "#C2");
+
+log.Location = ;
+Assert.AreEqual (System.IPath.Combine (, log.BaseFileName) + format + ".log", log.FullLogFileName, "#C3");
+
+log.Location = LogFileLocation.TempDirectory;
+Assert.AreEqual (System.IPath.Combine (, log.BaseFileName) + format + ".log", log.FullLogFileName, "#C4");
+
+log.Location = LogFileLocation.Custom;
+Assert.AreEqual (System.IPath.Combine (, log.BaseFileName) + format + ".log", log.FullLogFileName, "#C5");
+
+log.CustomLocation = ;
+Assert.AreEqual (System.IPath.Combine (, log.BaseFileName) + format + ".log", log.FullLogFileName, "#C6");
+}
+}
+
+[Test]
+[ExpectedException (typeof (IException))]
+public void DiskSpaceTest1 ()
+{
+using (FileLogTraceListener log = new FileLogTraceListener ()) {
+log.Location = LogFileLocation.TempDirectory;
+log.ReserveDiskSpace = new System.IDriveInfo (log.FullLogFileName [0].ToString ()).TotalFreeSpace;
+log.DiskSpaceExhaustedBehavior = DiskSpaceEThrowException;
+log.WriteLine ("TestLine");
+}
+}
+
+[Test]
+[ExpectedException (typeof (ArgumentException))]
+public void DiskSpaceTest2 ()
+{
+using (FileLogTraceListener log = new FileLogTraceListener ()) {
+log.MaxFileSize = 0;
+}
+}
+
+[Test]
+[ExpectedException (typeof (IException))]
+public void DiskSpaceTest3 ()
+{
+using (FileLogTraceListener log = new FileLogTraceListener ()) {
+log.Location = LogFileLocation.TempDirectory;
+log.MaxFileSize = 1000;
+log.DiskSpaceExhaustedBehavior = DiskSpaceEThrowException;
+log.Write (new string('z', 1001));
+}
+}
+
+[Test]
+public void WriteTest ()
+{
+using (FileLogTraceListener log = new FileLogTraceListener ()) {
+log.Filter = new ();
+string filename = log.FullLogFileName;
+string data;
+ cache = new ();
+
+log.TraceData (cache, "nunit", , 0, null);
+log.Close ();
+data = (filename);
+ (filename);
+
+Assert.AreEqual ("nunit\tCritical\t0\t\r\n", data, "#01");
+}
+
+
+using (FileLogTraceListener log = new FileLogTraceListener ()) {
+log.Filter = new ();
+string filename = log.FullLogFileName;
+string data;
+ cache = new ();
+
+log.TraceData (cache, "nunit", , 0, "data");
+log.Close ();
+data = (filename);
+ (filename);
+
+Assert.AreEqual ("nunit\tCritical\t0\tdata\r\n", data, "#02");
+}
+
+using (FileLogTraceListener log = new FileLogTraceListener ()) {
+log.Filter = new ();
+string filename = log.FullLogFileName;
+string data;
+ cache = new ();
+
+log.TraceData (cache, "nunit", , 0, "data", "data2");
+log.Close ();
+data = (filename);
+ (filename);
+
+Assert.AreEqual ("nunit\tCritical\t0\tdata\tdata2\r\n", data, "#03");
+}
+
+using (FileLogTraceListener log = new FileLogTraceListener ()) {
+log.Filter = new ();
+string filename = log.FullLogFileName;
+string data;
+ cache = new ();
+
+log.TraceEvent (cache, "nunit", , 0, "msg");
+log.Close ();
+data = (filename);
+ (filename);
+
+Assert.AreEqual ("nunit\tCritical\t0\tmsg\r\n", data, "#04");
+}
+
+
+using (FileLogTraceListener log = new FileLogTraceListener ()) {
+log.Filter = new ();
+string filename = log.FullLogFileName;
+string data;
+ cache = new ();
+
+log.TraceEvent (cache, "nunit", , 0, "msg:{0}", "arg1");
+log.Close ();
+data = (filename);
+ (filename);
+
+Assert.AreEqual ("nunit\tCritical\t0\tmsg:arg1\r\n", data, "#05");
+}
+
+using (FileLogTraceListener log = new FileLogTraceListener ()) {
+log.Filter = new ();
+string filename = log.FullLogFileName;
+string data;
+ cache = new ();
+
+log.T = System.Diagnostics.TDateTime | System.Diagnostics.TLStack | System.Diagnostics.TProcessId | System.Diagnostics.TThreadId | System.Diagnostics.TTimestamp;
+log.TraceData (cache, "nunit", , 0, null);
+log.Close ();
+data = (filename);
+ (filename);
+
+Assert.AreEqual ("nunit\tCritical\t0\t\t\"\"\t" + cache.DateTime.ToString ("u", CultureInfo.InvariantCulture) + "\t" + cache.ProcessId + "\t" + cache.ThreadId + "\t" + cache.Timestamp + System.Environment.NewLine, data, "#06");
+}
+
+
+using (FileLogTraceListener log = new FileLogTraceListener ()) {
+log.Filter = new ();
+log.IncludeHostName = true;
+
+string filename = log.FullLogFileName;
+string data;
+ cache = new ();
+
+log.T = System.Diagnostics.TDateTime | System.Diagnostics.TLStack | System.Diagnostics.TProcessId | System.Diagnostics.TThreadId | System.Diagnostics.TTimestamp;
+log.TraceData (cache, "nunit", , 0, null);
+log.Close ();
+data = (filename);
+ (filename);
+
+Assert.AreEqual ("nunit\tCritical\t0\t\t\"\"\t" + cache.DateTime.ToString ("u", CultureInfo.InvariantCulture) + "\t" + cache.ProcessId + "\t" + cache.ThreadId + "\t" + cache.Timestamp + "\t" + Environment.MachineName + System.Environment.NewLine, data, "#07");
+}
+}
+
+[Test]
+public void AppendTest ()
+{
+
+using (FileLogTraceListener log = new FileLogTraceListener ()) {
+log.Filter = new ();
+log.Append = false;
+string filename = log.FullLogFileName;
+string data;
+ cache = new ();
+
+log.TraceData (cache, "nunit", , 0, null);
+log.Close ();
+data = (filename);
+
+Assert.AreEqual ("nunit\tCritical\t0\t\r\n", data, "#01");
+}
+
+
+using (FileLogTraceListener log = new FileLogTraceListener ()) {
+log.Filter = new ();
+log.Append = true;
+string filename = log.FullLogFileName;
+string data;
+ cache = new ();
+
+log.TraceData (cache, "nunit", , 0, null);
+log.Close ();
+data = (filename);
+
+Assert.AreEqual ("nunit\tCritical\t0\t\r\n" + "nunit\tCritical\t0\t\r\n", data, "#02");
+}
+
+using (FileLogTraceListener log = new FileLogTraceListener ()) {
+log.Filter = new ();
+log.Append = false;
+string filename = log.FullLogFileName;
+string data;
+ cache = new ();
+
+log.TraceData (cache, "nunit", , 0, null);
+log.Close ();
+data = (filename);
+
+Assert.AreEqual ("nunit\tCritical\t0\t\r\n", data, "#03");
+ (filename);
+}
+
+
+}
+
+}
+
+class Derived : FileLogTraceListener
+{
+protected override string [] GetSupportedAttributes ()
+{
+return base.GetSupportedAttributes ();
+}
+
+public string [] GetAttribs ()
+{
+return GetSupportedAttributes ();
+}
+}
+}
+#endif
\ No newline at end of file
Added:
2007-01-15 09:13:19 UTC (rev 71008)
2007-01-15 09:14:21 UTC (rev 71009)
@@ -0,0 +1,230 @@
+// LogTest.cs - NUnit Test Cases for
+//
+// Rolf Bjarne Kvinge (RKvinge (AT) novell (DOT) com)
+//
+//
+// Copyright (C) 2007 Novell, Inc (http://www.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 SFTWARE IS PRVIDED "AS IS", WITHUT WARRANTY F ANY KIND,
+// EXPRESS R IMPLIED, INCLUDING BUT NT LIMITED T THE WARRANTIES F
+// MERCHANTABILITY, FITNESS FR A PARTICULAR PURPSE AND
+// NNINFRINGEMENT. IN N EVENT SHALL THE AUTHRS R CPYRIGHT HLDERS BE
+// LIABLE FR ANY CLAIM, DAMAGES R THER LIABILITY, WHETHER IN AN ACTIN
+// F CNTRACT, TRT R THERWISE, ARISING FRM, UT F R IN CNNECTIN
+// WITH THE SFTWARE R THE USE R THER DEALINGS IN THE SFTWARE.
+//
+#if NET_2_0
+using System;
+using System.Collections.Generic;
+using System.Text;
+using NUnit.Framework;
+using Microsoft.VisualBasic.Logging;
+
+namespace
+{
+[TestFixture]
+public class LoggingTest
+{
+[Test]
+[ExpectedException (typeof (ArgumentNullException))]
+public void TestWriteExNull1 ()
+{
+Log log = new Log ();
+log.WriteException (null);
+}
+
+[Test]
+[ExpectedException (typeof (ArgumentNullException))]
+public void TestWriteExNull2 ()
+{
+Log log = new Log ();
+log.WriteException (null, , "");
+}
+
+[Test]
+[ExpectedException (typeof (ArgumentNullException))]
+public void TestWriteExNull3 ()
+{
+Log log = new Log ();
+log.WriteException (null, , "", 0);
+}
+
+[Test]
+public void TestWriteEx1 ()
+{
+Log log = new Log ();
+string em = "ExceptionMessage";
+string ai = "AdditionalInformation";
+Exception ex = new Exception (em);
+System.IStringWriter writer = new System.IStringWriter();
+
+();
+log.TraceSource.Listeners.Add (new (writer));
+log.TraceSource.Switch.Level = ;
+
+writer.GetStringBuilder ().Length = 0;
+log.WriteException (ex, , "");
+Assert.AreEqual ("DefaultSource Information: 0 : ExceptionMessage" + System.Environment.NewLine, writer.ToString (), "#01");
+
+writer.GetStringBuilder ().Length = 0;
+log.WriteException (ex, , ai);
+Assert.AreEqual (string.Format("DefaultSource Error: 2 : {0} {1}" + System.Environment.NewLine, em, ai), writer.ToString (), "#02");
+
+writer.GetStringBuilder ().Length = 0;
+log.WriteException (ex, , ai, 200);
+Assert.AreEqual (string.Format ("DefaultSource Warning: 200 : {0} {1}" + System.Environment.NewLine, em, ai), writer.ToString (), "#03");
+
+writer.GetStringBuilder ().Length = 0;
+log.WriteException (ex);
+Assert.AreEqual (string.Format ("DefaultSource Error: 2 : {0}" + System.Environment.NewLine, em, ai), writer.ToString (), "#04");
+
+
+
+writer.GetStringBuilder ().Length = 0;
+log.WriteException (ex, , null);
+Assert.AreEqual (string.Format ("DefaultSource Critical: 3 : {0}" + System.Environment.NewLine, em, ai), writer.ToString (), "#10");
+
+writer.GetStringBuilder ().Length = 0;
+log.WriteException (ex, , null);
+Assert.AreEqual (string.Format ("DefaultSource Error: 2 : {0}" + System.Environment.NewLine, em, ai), writer.ToString (), "#11");
+
+writer.GetStringBuilder ().Length = 0;
+log.WriteException (ex, , null);
+Assert.AreEqual (string.Format ("DefaultSource Information: 0 : {0}" + System.Environment.NewLine, em, ai), writer.ToString (), "#12");
+
+writer.GetStringBuilder ().Length = 0;
+log.WriteException (ex, , null);
+Assert.AreEqual (string.Format ("DefaultSource Resume: 7 : {0}" + System.Environment.NewLine, em, ai), writer.ToString (), "#13");
+
+writer.GetStringBuilder ().Length = 0;
+log.WriteException (ex, , null);
+Assert.AreEqual (string.Format ("DefaultSource Start: 4 : {0}" + System.Environment.NewLine, em, ai), writer.ToString (), "#14");
+
+writer.GetStringBuilder ().Length = 0;
+log.WriteException (ex, , null);
+Assert.AreEqual (string.Format ("DefaultSource Stop: 5 : {0}" + System.Environment.NewLine, em, ai), writer.ToString (), "#15");
+
+writer.GetStringBuilder ().Length = 0;
+log.WriteException (ex, , null);
+Assert.AreEqual (string.Format ("DefaultSource Suspend: 6 : {0}" + System.Environment.NewLine, em, ai), writer.ToString (), "#16");
+
+writer.GetStringBuilder ().Length = 0;
+log.WriteException (ex, , null);
+Assert.AreEqual (string.Format ("DefaultSource Transfer: 9 : {0}" + System.Environment.NewLine, em, ai), writer.ToString (), "#17");
+
+writer.GetStringBuilder ().Length = 0;
+log.WriteException (ex, , null);
+Assert.AreEqual (string.Format ("DefaultSource Verbose: 8 : {0}" + System.Environment.NewLine, em, ai), writer.ToString (), "#18");
+
+writer.GetStringBuilder ().Length = 0;
+log.WriteException (ex, , null);
+Assert.AreEqual (string.Format ("DefaultSource Warning: 1 : {0}" + System.Environment.NewLine, em, ai), writer.ToString (), "#19");
+}
+
+
+[Test]
+public void TestWriteEntry1 ()
+{
+Log log = new Log ();
+string msg = "AdditionalInformation";
+
+System.IStringWriter writer = new System.IStringWriter ();
+
+ ();
+log.TraceSource.Listeners.Add (new (writer));
+log.TraceSource.Switch.Level = ;
+
+writer.GetStringBuilder ().Length = 0;
+log.WriteEntry (msg);
+Assert.AreEqual ("DefaultSource Information: 0 : AdditionalInformation" + System.Environment.NewLine, writer.ToString (), "#01");
+
+writer.GetStringBuilder ().Length = 0;
+log.WriteEntry (msg, );
+Assert.AreEqual (string.Format ("DefaultSource Error: 2 : {0}" + System.Environment.NewLine, msg), writer.ToString (), "#02");
+
+writer.GetStringBuilder ().Length = 0;
+log.WriteEntry (msg, , 200);
+Assert.AreEqual (string.Format ("DefaultSource Warning: 200 : {0}" + System.Environment.NewLine, msg), writer.ToString (), "#03");
+
+writer.GetStringBuilder ().Length = 0;
+log.WriteEntry (msg, );
+Assert.AreEqual (string.Format ("DefaultSource Suspend: 6 : {0}" + System.Environment.NewLine, msg), writer.ToString (), "#04");
+
+writer.GetStringBuilder ().Length = 0;
+log.WriteEntry (null);
+Assert.AreEqual (string.Format ("DefaultSource Information: 0 : " + System.Environment.NewLine), writer.ToString (), "#05");
+
+
+writer.GetStringBuilder ().Length = 0;
+log.WriteEntry (msg, );
+Assert.AreEqual (string.Format ("DefaultSource Critical: 3 : {0}" + System.Environment.NewLine, msg), writer.ToString (), "#10");
+
+writer.GetStringBuilder ().Length = 0;
+log.WriteEntry (msg, );
+Assert.AreEqual (string.Format ("DefaultSource Error: 2 : {0}" + System.Environment.NewLine, msg), writer.ToString (), "#11");
+
+writer.GetStringBuilder ().Length = 0;
+log.WriteEntry (msg, );
+Assert.AreEqual (string.Format ("DefaultSource Information: 0 : {0}" + System.Environment.NewLine, msg), writer.ToString (), "#12");
+
+writer.GetStringBuilder ().Length = 0;
+log.WriteEntry (msg, );
+Assert.AreEqual (string.Format ("DefaultSource Resume: 7 : {0}" + System.Environment.NewLine, msg), writer.ToString (), "#13");
+
+writer.GetStringBuilder ().Length = 0;
+log.WriteEntry (msg, );
+Assert.AreEqual (string.Format ("DefaultSource Start: 4 : {0}" + System.Environment.NewLine, msg), writer.ToString (), "#14");
+
+writer.GetStringBuilder ().Length = 0;
+log.WriteEntry (msg, );
+Assert.AreEqual (string.Format ("DefaultSource Stop: 5 : {0}" + System.Environment.NewLine, msg), writer.ToString (), "#15");
+
+writer.GetStringBuilder ().Length = 0;
+log.WriteEntry (msg, );
+Assert.AreEqual (string.Format ("DefaultSource Suspend: 6 : {0}" + System.Environment.NewLine, msg), writer.ToString (), "#16");
+
+writer.GetStringBuilder ().Length = 0;
+log.WriteEntry (msg, );
+Assert.AreEqual (string.Format ("DefaultSource Transfer: 9 : {0}" + System.Environment.NewLine, msg), writer.ToString (), "#17");
+
+writer.GetStringBuilder ().Length = 0;
+log.WriteEntry (msg, );
+Assert.AreEqual (string.Format ("DefaultSource Verbose: 8 : {0}" + System.Environment.NewLine, msg), writer.ToString (), "#18");
+
+writer.GetStringBuilder ().Length = 0;
+log.WriteEntry (msg, );
+Assert.AreEqual (string.Format ("DefaultSource Warning: 1 : {0}" + System.Environment.NewLine, msg), writer.ToString (), "#19");
+}
+
+[Test]
+public void TestDefaults ()
+{
+Log log = new Log ();
+Assert.AreEqual ("FileLog", log.DefaultFileLogWriter.Name, "#01");
+Assert.AreEqual ("DefaultSource", log.TraceSource.Name, "#02");
+Assert.AreEqual (2, , "#03");
+Assert.AreEqual ("Default", (log.TraceSource.Listeners) [0].Name, "#04");
+Assert.AreEqual ("FileLog", (log.TraceSource.Listeners) [1].Name, "#05");
+Assert.AreEqual ("DefaultTraceListener", (log.TraceSource.Listeners) [0].GetType ().Name, "#06");
+Assert.AreEqual ("FileLogTraceListener", (log.TraceSource.Listeners) [1].GetType ().Name, "#07");
+Assert.AreEqual (, log.TraceSource.Switch.Level, "#08");
+}
+
+private [] (System.Collections.IEnumerable en)
+{
+return H < (en);
+}
+}
+}
+#endif
\ No newline at end of file
Mono-patches maillist - Mono-patches (AT) lists (DOT) ximian.com