mirror of
https://github.com/Sonarr/Sonarr.git
synced 2024-12-16 11:37:58 +02:00
Fixed tests.
This commit is contained in:
parent
958153be55
commit
c38973cce4
@ -1,12 +1,13 @@
|
||||
using System;
|
||||
using System.Threading;
|
||||
using FluentAssertions;
|
||||
using Marr.Data;
|
||||
using NLog;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Common.Instrumentation;
|
||||
using NzbDrone.Core.Datastore.Migration.Framework;
|
||||
using NzbDrone.Core.MediaFiles;
|
||||
using NzbDrone.Core.Instrumentation;
|
||||
using NzbDrone.Core.MediaFiles;
|
||||
using NzbDrone.Core.Test.Framework;
|
||||
using NzbDrone.Test.Common;
|
||||
using NzbDrone.Test.Common.Categories;
|
||||
@ -35,7 +36,6 @@ public void Setup()
|
||||
|
||||
LogManager.ReconfigExistingLoggers();
|
||||
|
||||
|
||||
_logger = NzbDroneLogger.GetLogger(this);
|
||||
|
||||
_uniqueMessage = "Unique message: " + Guid.NewGuid();
|
||||
@ -46,6 +46,8 @@ public void write_log()
|
||||
{
|
||||
_logger.Info(_uniqueMessage);
|
||||
|
||||
Thread.Sleep(600);
|
||||
|
||||
StoredModel.Message.Should().Be(_uniqueMessage);
|
||||
VerifyLog(StoredModel, LogLevel.Info);
|
||||
}
|
||||
@ -61,6 +63,8 @@ public void write_long_log()
|
||||
|
||||
_logger.Info(message);
|
||||
|
||||
Thread.Sleep(600);
|
||||
|
||||
StoredModel.Message.Should().HaveLength(message.Length);
|
||||
StoredModel.Message.Should().Be(message);
|
||||
VerifyLog(StoredModel, LogLevel.Info);
|
||||
@ -77,6 +81,9 @@ public void perf_test()
|
||||
{
|
||||
_logger.Info(Guid.NewGuid());
|
||||
}
|
||||
|
||||
Thread.Sleep(600);
|
||||
|
||||
MapRepository.Instance.EnableTraceLogging = true;
|
||||
}
|
||||
|
||||
@ -87,6 +94,7 @@ public void write_log_exception()
|
||||
|
||||
_logger.Error(ex, _uniqueMessage);
|
||||
|
||||
Thread.Sleep(600);
|
||||
|
||||
VerifyLog(StoredModel, LogLevel.Error);
|
||||
StoredModel.Message.Should().Be(_uniqueMessage + ": " + ex.Message);
|
||||
@ -99,13 +107,13 @@ public void write_log_exception()
|
||||
[Test]
|
||||
public void exception_log_with_no_message_should_use_exceptions_message()
|
||||
{
|
||||
|
||||
var ex = new InvalidOperationException("Fake Exception");
|
||||
_uniqueMessage = string.Empty;
|
||||
|
||||
|
||||
_logger.Error(ex, _uniqueMessage);
|
||||
|
||||
Thread.Sleep(600);
|
||||
|
||||
StoredModel.Message.Should().Be(ex.Message);
|
||||
|
||||
VerifyLog(StoredModel, LogLevel.Error);
|
||||
@ -119,6 +127,8 @@ public void null_string_as_arg_should_not_fail()
|
||||
var epFile = new EpisodeFile();
|
||||
_logger.Debug("File {0} no longer exists on disk. removing from database.", epFile.RelativePath);
|
||||
|
||||
Thread.Sleep(600);
|
||||
|
||||
epFile.RelativePath.Should().BeNull();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user