If something bad happened and we caught a non fatal exception this message is logged.
View code on GitHub Namespace: DeltaEngine.CoreAssembly: DeltaEngine (in DeltaEngine.dll) Version: 1.1.1.0 (1.1.1)
public static void Warning(
Exception exception
)
public static void Warning(
Exception exception
)
Public Shared Sub Warning (
exception As Exception
)
Public Shared Sub Warning (
exception As Exception
)
public:
static void Warning(
Exception^ exception
)
public:
static void Warning(
Exception^ exception
)
static member Warning :
exception : Exception -> unit
static member Warning :
exception : Exception -> unit
Tests:
DeltaEngine.Tests.Core.LoggerTests2 unit tests call DeltaEngine.Core.Logger.Warning(System.Exception)
[Test]
public void LogWarning()
{
using (var logger = new MockLogger())
{
Logger.Warning("Ohoh");
Assert.AreEqual("Ohoh", logger.LastMessage);
Logger.Warning(new NullReferenceException());
Assert.IsTrue(logger.LastMessage.Contains("NullReferenceException"));
}
}
[Test]
public void LogWarning()
{
using (var logger = new MockLogger())
{
Logger.Warning("Ohoh");
Assert.AreEqual("Ohoh", logger.LastMessage);
Logger.Warning(new NullReferenceException());
Assert.IsTrue(logger.LastMessage.Contains("NullReferenceException"));
}
}
[Test]
public void IfNoLoggerIsAttachedWeGetAWarning()
{
const string Warning = "Ohoh";
const string Message = "No loggers have been created for this message: " + Warning;
var defaultOut = Console.Out;
var console = new StringWriter();
Console.SetOut(console);
Logger.Warning(Warning);
Assert.IsTrue(console.ToString().Contains(Message), console.ToString());
Console.SetOut(defaultOut);
console.Dispose();
}
[Test]
public void IfNoLoggerIsAttachedWeGetAWarning()
{
const string Warning = "Ohoh";
const string Message = "No loggers have been created for this message: " + Warning;
var defaultOut = Console.Out;
var console = new StringWriter();
Console.SetOut(console);
Logger.Warning(Warning);
Assert.IsTrue(console.ToString().Contains(Message), console.ToString());
Console.SetOut(defaultOut);
console.Dispose();
}