Logger LastMessage Property Delta Engine Documentation

Namespace: DeltaEngine.Core
Assembly: DeltaEngine (in DeltaEngine.dll) Version: 1.1.1.0 (1.1.1)
Syntax

public string LastMessage { get; protected set; }

Property Value

Type: String
Remarks

Tests: DeltaEngine.Tests.Core.LoggerTests
Examples

3 unit tests call DeltaEngine.Core.Logger.LastMessage
[Test]
public void LogInfoMessage()
{
    using (var logger = new MockLogger())
    {
        Assert.IsEmpty(logger.LastMessage);
        Logger.Info("Hello");
        Assert.AreEqual("Hello", logger.LastMessage);
        Assert.AreEqual(0, logger.NumberOfRepeatedMessagesIgnored);
    }
}
[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 LogError()
{
    using (var logger = new MockLogger())
    {
        Logger.Error(new ExternalException());
        Assert.IsTrue(logger.LastMessage.Contains(new ExternalException().Message),
            logger.LastMessage);
    }
}
See Also