SimpleLog/SimpleLog.Tests/ConsoleLogHandlerTest.cs

37 lines
968 B
C#

using System;
using NUnit.Framework;
using NUnit.Framework.SyntaxHelpers;
using SimpleLog.LogHandlers;
namespace SimpleLog.Tests {
[TestFixture]
public class ConsoleLogHandlerTest {
private ConsoleLogHandler handler;
[SetUp]
public void Init() {
handler = new ConsoleLogHandler();
}
[Test]
public void TestLog() {
Assert.That(this.handler.Log("yay", Framework.LogLevel.Critical));
Assert.That(this.handler.Log("yay", Framework.LogLevel.Debug));
}
[Test]
public void TestGetOutputStream() {
Assert.That(this.handler.GetOutputStream(ConsoleLogHandler.STD_ERROR_HANDLE), Is.SameAs(Console.Error));
Assert.That(this.handler.GetOutputStream(ConsoleLogHandler.STD_OUTPUT_HANDLE), Is.SameAs(Console.Out));
}
[Test]
public void TestAccessors() {
Assert.That(handler.MessageHandler, Is.TypeOf(typeof(DefaultMessageHandler)));
Assert.That(handler.LogLevel, Is.EqualTo(null));
}
}
}