mirror of
https://github.com/Radarr/Radarr.git
synced 2024-11-04 10:02:40 +01:00
fixed disk scan scheduler.
This commit is contained in:
parent
42849d3276
commit
687f8d9384
@ -8,14 +8,6 @@ namespace NzbDrone.Api.Extensions
|
||||
{
|
||||
public class NancyJsonSerializer : ISerializer
|
||||
{
|
||||
private readonly IJsonSerializer _jsonSerializer;
|
||||
|
||||
public NancyJsonSerializer(IJsonSerializer jsonSerializer)
|
||||
{
|
||||
_jsonSerializer = jsonSerializer;
|
||||
}
|
||||
|
||||
|
||||
public bool CanSerialize(string contentType)
|
||||
{
|
||||
return true;
|
||||
@ -23,7 +15,7 @@ public bool CanSerialize(string contentType)
|
||||
|
||||
public void Serialize<TModel>(string contentType, TModel model, Stream outputStream)
|
||||
{
|
||||
_jsonSerializer.Serialize(model, outputStream);
|
||||
Json.Serialize(model, outputStream);
|
||||
}
|
||||
|
||||
public IEnumerable<string> Extensions { get; private set; }
|
||||
|
@ -2,15 +2,13 @@
|
||||
using System.IO;
|
||||
using Nancy;
|
||||
using Nancy.Responses;
|
||||
using NzbDrone.Common;
|
||||
using NzbDrone.Common.Serializer;
|
||||
|
||||
namespace NzbDrone.Api.Extensions
|
||||
{
|
||||
public static class JsonExtensions
|
||||
{
|
||||
private static readonly JsonSerializer Serializer = new JsonSerializer();
|
||||
private static readonly NancyJsonSerializer NancySerializer = new NancyJsonSerializer(Serializer);
|
||||
private static readonly NancyJsonSerializer NancySerializer = new NancyJsonSerializer();
|
||||
|
||||
public static T FromJson<T>(this Stream body) where T : class, new()
|
||||
{
|
||||
@ -22,7 +20,7 @@ public static T FromJson<T>(this Stream body, Type type)
|
||||
var reader = new StreamReader(body, true);
|
||||
body.Position = 0;
|
||||
var value = reader.ReadToEnd();
|
||||
return (T)Serializer.Deserialize(value, type);
|
||||
return (T)Json.Deserialize(value, type);
|
||||
}
|
||||
|
||||
public static JsonResponse<TModel> AsResponse<TModel>(this TModel model, HttpStatusCode statusCode = HttpStatusCode.OK)
|
||||
|
@ -2,27 +2,20 @@
|
||||
using System.IO;
|
||||
using Microsoft.AspNet.SignalR.Json;
|
||||
using NzbDrone.Common.Composition;
|
||||
using NzbDrone.Common.Serializer;
|
||||
|
||||
namespace NzbDrone.Api.SignalR
|
||||
{
|
||||
[Singleton]
|
||||
public class Serializer : IJsonSerializer
|
||||
{
|
||||
private readonly Common.Serializer.IJsonSerializer _nzbDroneSerializer;
|
||||
private readonly JsonNetSerializer _signalRSerializer;
|
||||
|
||||
public Serializer(Common.Serializer.IJsonSerializer nzbDroneSerializer)
|
||||
{
|
||||
_signalRSerializer = new JsonNetSerializer();
|
||||
_nzbDroneSerializer = nzbDroneSerializer;
|
||||
|
||||
}
|
||||
private readonly JsonNetSerializer _signalRSerializer = new JsonNetSerializer();
|
||||
|
||||
public void Serialize(object value, TextWriter writer)
|
||||
{
|
||||
if (value.GetType().FullName.StartsWith("NzbDrone"))
|
||||
{
|
||||
_nzbDroneSerializer.Serialize(value, writer);
|
||||
Json.Serialize(value, writer);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -35,7 +28,7 @@ public object Parse(string json, Type targetType)
|
||||
{
|
||||
if (targetType.FullName.StartsWith("NzbDrone"))
|
||||
{
|
||||
return _nzbDroneSerializer.Deserialize(json, targetType);
|
||||
return Json.Deserialize(json, targetType);
|
||||
}
|
||||
|
||||
return _signalRSerializer.Parse(json, targetType);
|
||||
|
@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Common.Messaging;
|
||||
@ -38,6 +39,17 @@ public void should_publish_command_to_executor()
|
||||
_executorA.Verify(c => c.Execute(commandA), Times.Once());
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_publish_command_by_with_optional_arg_with_name()
|
||||
{
|
||||
Mocker.GetMock<IServiceFactory>().Setup(c => c.GetImplementations(typeof(ICommand)))
|
||||
.Returns(new List<Type> { typeof(CommandA), typeof(CommandB) });
|
||||
|
||||
Subject.PublishCommand(typeof(CommandA).FullName);
|
||||
_executorA.Verify(c => c.Execute(It.IsAny<CommandA>()), Times.Once());
|
||||
}
|
||||
|
||||
|
||||
[Test]
|
||||
public void should_not_publish_to_incompatible_executor()
|
||||
{
|
||||
@ -63,9 +75,12 @@ public void broken_executor_should_throw_the_exception()
|
||||
}
|
||||
|
||||
public class CommandA : ICommand
|
||||
{
|
||||
public CommandA(int id = 0)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public class CommandB : ICommand
|
||||
{
|
||||
|
@ -5,7 +5,8 @@
|
||||
/// </summary>
|
||||
public interface IMessageAggregator
|
||||
{
|
||||
void PublishEvent<TEvent>(TEvent @event) where TEvent : IEvent;
|
||||
void PublishCommand<TCommand>(TCommand command) where TCommand : ICommand;
|
||||
void PublishEvent<TEvent>(TEvent @event) where TEvent : class, IEvent;
|
||||
void PublishCommand<TCommand>(TCommand command) where TCommand : class, ICommand;
|
||||
void PublishCommand(string commandType);
|
||||
}
|
||||
}
|
@ -1,8 +1,11 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Threading.Tasks;
|
||||
using NLog;
|
||||
using NzbDrone.Common.Composition;
|
||||
using NzbDrone.Common.EnsureThat;
|
||||
using NzbDrone.Common.Serializer;
|
||||
|
||||
namespace NzbDrone.Common.Messaging
|
||||
{
|
||||
@ -18,8 +21,10 @@ public MessageAggregator(Logger logger, IServiceFactory serviceFactory)
|
||||
_serviceFactory = serviceFactory;
|
||||
}
|
||||
|
||||
public void PublishEvent<TEvent>(TEvent @event) where TEvent : IEvent
|
||||
public void PublishEvent<TEvent>(TEvent @event) where TEvent : class ,IEvent
|
||||
{
|
||||
Ensure.That(() => @event).IsNotNull();
|
||||
|
||||
var eventName = GetEventName(@event.GetType());
|
||||
|
||||
_logger.Trace("Publishing {0}", eventName);
|
||||
@ -63,8 +68,10 @@ private static string GetEventName(Type eventType)
|
||||
}
|
||||
|
||||
|
||||
public void PublishCommand<TCommand>(TCommand command) where TCommand : ICommand
|
||||
public void PublishCommand<TCommand>(TCommand command) where TCommand : class, ICommand
|
||||
{
|
||||
Ensure.That(() => command).IsNotNull();
|
||||
|
||||
var handlerContract = typeof(IExecute<>).MakeGenericType(command.GetType());
|
||||
|
||||
_logger.Trace("Publishing {0}", command.GetType().Name);
|
||||
@ -95,5 +102,15 @@ public void PublishCommand<TCommand>(TCommand command) where TCommand : ICommand
|
||||
|
||||
_logger.Debug("{0} <- {1}", command.GetType().Name, handler.GetType().Name);
|
||||
}
|
||||
|
||||
public void PublishCommand(string commandTypeName)
|
||||
{
|
||||
var commandType = _serviceFactory.GetImplementations(typeof(ICommand))
|
||||
.Single(c => c.FullName.Equals(commandTypeName, StringComparison.InvariantCultureIgnoreCase));
|
||||
|
||||
//json.net is better at creating objects
|
||||
var command = Json.Deserialize("{}", commandType);
|
||||
PublishCommand((ICommand)command);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -103,7 +103,7 @@
|
||||
<Compile Include="EnsureThat\Resources\ExceptionMessages.Designer.cs" />
|
||||
<Compile Include="EnsureThat\StringExtensions.cs" />
|
||||
<Compile Include="EnsureThat\TypeParam.cs" />
|
||||
<Compile Include="Serializer\JsonSerializer.cs" />
|
||||
<Compile Include="Serializer\Json.cs" />
|
||||
<Compile Include="Messaging\CommandCompletedEvent.cs" />
|
||||
<Compile Include="Messaging\CommandStartedEvent.cs" />
|
||||
<Compile Include="Messaging\CommandFailedEvent.cs" />
|
||||
|
58
NzbDrone.Common/Serializer/Json.cs
Normal file
58
NzbDrone.Common/Serializer/Json.cs
Normal file
@ -0,0 +1,58 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Converters;
|
||||
using Newtonsoft.Json.Serialization;
|
||||
|
||||
namespace NzbDrone.Common.Serializer
|
||||
{
|
||||
public static class Json
|
||||
{
|
||||
private static readonly JsonSerializer JsonNetSerializer;
|
||||
|
||||
|
||||
static Json()
|
||||
{
|
||||
JsonNetSerializer = new JsonSerializer()
|
||||
{
|
||||
DateTimeZoneHandling = DateTimeZoneHandling.Utc,
|
||||
NullValueHandling = NullValueHandling.Ignore,
|
||||
Formatting = Formatting.Indented,
|
||||
DefaultValueHandling = DefaultValueHandling.Include,
|
||||
ContractResolver = new CamelCasePropertyNamesContractResolver()
|
||||
};
|
||||
|
||||
JsonNetSerializer.Converters.Add(new StringEnumConverter { CamelCaseText = true });
|
||||
}
|
||||
|
||||
public static T Deserialize<T>(string json) where T : class, new()
|
||||
{
|
||||
return JsonConvert.DeserializeObject<T>(json);
|
||||
}
|
||||
|
||||
public static object Deserialize(string json, Type type)
|
||||
{
|
||||
return JsonConvert.DeserializeObject(json, type);
|
||||
}
|
||||
|
||||
public static string Serialize(object obj)
|
||||
{
|
||||
return JsonConvert.SerializeObject(obj);
|
||||
}
|
||||
|
||||
|
||||
public static void Serialize<TModel>(TModel model, TextWriter outputStream)
|
||||
{
|
||||
var jsonTextWriter = new JsonTextWriter(outputStream);
|
||||
JsonNetSerializer.Serialize(jsonTextWriter, model);
|
||||
jsonTextWriter.Flush();
|
||||
}
|
||||
|
||||
public static void Serialize<TModel>(TModel model, Stream outputStream)
|
||||
{
|
||||
Serialize(model, new StreamWriter(outputStream));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
@ -1,66 +0,0 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Converters;
|
||||
using Newtonsoft.Json.Serialization;
|
||||
|
||||
namespace NzbDrone.Common.Serializer
|
||||
{
|
||||
public interface IJsonSerializer
|
||||
{
|
||||
T Deserialize<T>(string json) where T : class, new();
|
||||
string Serialize(object obj);
|
||||
void Serialize<TModel>(TModel model, TextWriter textWriter);
|
||||
void Serialize<TModel>(TModel model, Stream outputStream);
|
||||
object Deserialize(string json, Type type);
|
||||
}
|
||||
|
||||
public class JsonSerializer : IJsonSerializer
|
||||
{
|
||||
private readonly Newtonsoft.Json.JsonSerializer _jsonNetSerializer;
|
||||
|
||||
public JsonSerializer()
|
||||
{
|
||||
_jsonNetSerializer = new Newtonsoft.Json.JsonSerializer()
|
||||
{
|
||||
DateTimeZoneHandling = DateTimeZoneHandling.Utc,
|
||||
NullValueHandling = NullValueHandling.Ignore,
|
||||
Formatting = Formatting.Indented,
|
||||
DefaultValueHandling = DefaultValueHandling.Include,
|
||||
ContractResolver = new CamelCasePropertyNamesContractResolver()
|
||||
};
|
||||
|
||||
_jsonNetSerializer.Converters.Add(new StringEnumConverter { CamelCaseText = true });
|
||||
}
|
||||
|
||||
public T Deserialize<T>(string json) where T : class, new()
|
||||
{
|
||||
return JsonConvert.DeserializeObject<T>(json);
|
||||
}
|
||||
|
||||
public object Deserialize(string json, Type type)
|
||||
{
|
||||
return JsonConvert.DeserializeObject(json, type);
|
||||
}
|
||||
|
||||
public string Serialize(object obj)
|
||||
{
|
||||
return JsonConvert.SerializeObject(obj);
|
||||
}
|
||||
|
||||
|
||||
public void Serialize<TModel>(TModel model, TextWriter outputStream)
|
||||
{
|
||||
var jsonTextWriter = new JsonTextWriter(outputStream);
|
||||
_jsonNetSerializer.Serialize(jsonTextWriter, model);
|
||||
jsonTextWriter.Flush();
|
||||
}
|
||||
|
||||
public void Serialize<TModel>(TModel model, Stream outputStream)
|
||||
{
|
||||
Serialize(model, new StreamWriter(outputStream));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
@ -10,6 +10,7 @@ public interface IServiceFactory
|
||||
T Build<T>() where T : class;
|
||||
IEnumerable<T> BuildAll<T>() where T : class;
|
||||
object Build(Type contract);
|
||||
IEnumerable<Type> GetImplementations(Type contract);
|
||||
}
|
||||
|
||||
public class ServiceFactory : IServiceFactory
|
||||
@ -35,5 +36,10 @@ public object Build(Type contract)
|
||||
{
|
||||
return _container.Resolve(contract);
|
||||
}
|
||||
|
||||
public IEnumerable<Type> GetImplementations(Type contract)
|
||||
{
|
||||
return _container.GetImplementations(contract);
|
||||
}
|
||||
}
|
||||
}
|
@ -41,8 +41,8 @@ public class TypeWithNoMappableProperties
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
{
|
||||
MapRepository.Instance.RegisterTypeConverter(typeof(List<EmbeddedType>), new EmbeddedDocumentConverter(new JsonSerializer()));
|
||||
MapRepository.Instance.RegisterTypeConverter(typeof(EmbeddedType), new EmbeddedDocumentConverter(new JsonSerializer()));
|
||||
MapRepository.Instance.RegisterTypeConverter(typeof(List<EmbeddedType>), new EmbeddedDocumentConverter());
|
||||
MapRepository.Instance.RegisterTypeConverter(typeof(EmbeddedType), new EmbeddedDocumentConverter());
|
||||
MapRepository.Instance.RegisterTypeConverter(typeof(Int32), new Int32Converter());
|
||||
|
||||
}
|
||||
|
@ -17,14 +17,12 @@ public class DailySeriesDataProxy : IDailySeriesDataProxy
|
||||
{
|
||||
private readonly IHttpProvider _httpProvider;
|
||||
private readonly IConfigService _configService;
|
||||
private readonly IJsonSerializer _jsonSerializer;
|
||||
private readonly Logger _logger;
|
||||
|
||||
public DailySeriesDataProxy(IHttpProvider httpProvider, IConfigService configService, IJsonSerializer jsonSerializer, Logger logger)
|
||||
public DailySeriesDataProxy(IHttpProvider httpProvider, IConfigService configService, Logger logger)
|
||||
{
|
||||
_httpProvider = httpProvider;
|
||||
_configService = configService;
|
||||
_jsonSerializer = jsonSerializer;
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
@ -34,7 +32,7 @@ public IEnumerable<int> GetDailySeriesIds()
|
||||
{
|
||||
var dailySeriesIds = _httpProvider.DownloadString(_configService.ServiceRootUrl + "/DailySeries/AllIds");
|
||||
|
||||
var seriesIds = _jsonSerializer.Deserialize<List<int>>(dailySeriesIds);
|
||||
var seriesIds = Json.Deserialize<List<int>>(dailySeriesIds);
|
||||
|
||||
return seriesIds;
|
||||
}
|
||||
|
@ -14,19 +14,19 @@ public class SceneMappingProxy : ISceneMappingProxy
|
||||
{
|
||||
private readonly IHttpProvider _httpProvider;
|
||||
private readonly IConfigService _configService;
|
||||
private readonly IJsonSerializer _jsonSerializer;
|
||||
|
||||
public SceneMappingProxy(IHttpProvider httpProvider, IConfigService configService, IJsonSerializer jsonSerializer)
|
||||
|
||||
public SceneMappingProxy(IHttpProvider httpProvider, IConfigService configService)
|
||||
{
|
||||
_httpProvider = httpProvider;
|
||||
_configService = configService;
|
||||
_jsonSerializer = jsonSerializer;
|
||||
|
||||
}
|
||||
|
||||
public List<SceneMapping> Fetch()
|
||||
{
|
||||
var mappingsJson = _httpProvider.DownloadString(_configService.ServiceRootUrl + "/SceneMapping/Active");
|
||||
return _jsonSerializer.Deserialize<List<SceneMapping>>(mappingsJson);
|
||||
return Json.Deserialize<List<SceneMapping>>(mappingsJson);
|
||||
}
|
||||
}
|
||||
}
|
@ -8,12 +8,6 @@ namespace NzbDrone.Core.Datastore.Converters
|
||||
{
|
||||
public class EmbeddedDocumentConverter : IConverter
|
||||
{
|
||||
private readonly IJsonSerializer _serializer;
|
||||
|
||||
public EmbeddedDocumentConverter(IJsonSerializer serializer)
|
||||
{
|
||||
_serializer = serializer;
|
||||
}
|
||||
|
||||
public object FromDB(ColumnMap map, object dbValue)
|
||||
{
|
||||
@ -29,14 +23,14 @@ public object FromDB(ColumnMap map, object dbValue)
|
||||
return null;
|
||||
}
|
||||
|
||||
return _serializer.Deserialize(stringValue, map.FieldType);
|
||||
return Json.Deserialize(stringValue, map.FieldType);
|
||||
}
|
||||
|
||||
public object ToDB(object clrValue)
|
||||
{
|
||||
if (clrValue == null) return null;
|
||||
|
||||
var json = _serializer.Serialize(clrValue);
|
||||
var json = Json.Serialize(clrValue);
|
||||
return json;
|
||||
}
|
||||
|
||||
|
@ -91,7 +91,7 @@ private static void RegisterEmbeddedConverter()
|
||||
.Where(c => c.GetInterfaces().Any(i => i == typeof(IEmbeddedDocument)));
|
||||
|
||||
|
||||
var embeddedConvertor = new EmbeddedDocumentConverter(new JsonSerializer());
|
||||
var embeddedConvertor = new EmbeddedDocumentConverter();
|
||||
var genericListDefinition = typeof(List<>).GetGenericTypeDefinition();
|
||||
foreach (var embeddedType in embeddedTypes)
|
||||
{
|
||||
|
@ -9,7 +9,7 @@ namespace NzbDrone.Core.Indexers
|
||||
|
||||
public TSetting ImportSettingsFromJson(string json)
|
||||
{
|
||||
Settings = new JsonSerializer().Deserialize<TSetting>(json) ?? new TSetting();
|
||||
Settings = Json.Deserialize<TSetting>(json) ?? new TSetting();
|
||||
|
||||
return Settings;
|
||||
}
|
||||
|
@ -8,12 +8,6 @@ namespace NzbDrone.Core.Indexers.Newznab
|
||||
{
|
||||
public class Newznab : IndexerWithSetting<NewznabSettings>
|
||||
{
|
||||
private readonly IJsonSerializer _jsonSerializer;
|
||||
|
||||
public Newznab()
|
||||
{
|
||||
_jsonSerializer = new JsonSerializer();
|
||||
}
|
||||
|
||||
|
||||
public override IEnumerable<IndexerDefinition> DefaultDefinitions
|
||||
@ -54,7 +48,7 @@ public override IEnumerable<IndexerDefinition> DefaultDefinitions
|
||||
|
||||
private string GetSettings(string url)
|
||||
{
|
||||
return _jsonSerializer.Serialize(new NewznabSettings { Url = url });
|
||||
return Json.Serialize(new NewznabSettings { Url = url });
|
||||
}
|
||||
|
||||
public override IEnumerable<string> RecentFeed
|
||||
|
@ -5,6 +5,7 @@
|
||||
using NzbDrone.Common.Messaging;
|
||||
using NzbDrone.Core.Indexers;
|
||||
using NzbDrone.Core.Lifecycle;
|
||||
using NzbDrone.Core.MediaFiles.Commands;
|
||||
using NzbDrone.Core.Providers;
|
||||
|
||||
namespace NzbDrone.Core.Jobs
|
||||
@ -36,7 +37,8 @@ public void Handle(ApplicationStartedEvent message)
|
||||
var defaultTasks = new[]
|
||||
{
|
||||
new ScheduledTask{ Interval = 25, TypeName = typeof(RssSyncCommand).FullName},
|
||||
new ScheduledTask{ Interval = 24*60, TypeName = typeof(UpdateXemMappings).FullName}
|
||||
new ScheduledTask{ Interval = 12*60, TypeName = typeof(UpdateXemMappings).FullName},
|
||||
new ScheduledTask{ Interval = 6*60, TypeName = typeof(DiskScanCommand).FullName}
|
||||
};
|
||||
|
||||
var currentTasks = _scheduledTaskRepository.All();
|
||||
|
@ -15,7 +15,6 @@ namespace NzbDrone.Integration.Test.Client
|
||||
private readonly string _resource;
|
||||
|
||||
private readonly Logger _logger;
|
||||
private readonly JsonSerializer _jsonSerializer;
|
||||
|
||||
public ClientBase(IRestClient restClient, string resource = null)
|
||||
{
|
||||
@ -27,10 +26,6 @@ public ClientBase(IRestClient restClient, string resource = null)
|
||||
_restClient = restClient;
|
||||
_resource = resource;
|
||||
|
||||
_jsonSerializer = new JsonSerializer();
|
||||
|
||||
|
||||
|
||||
_logger = LogManager.GetLogger("REST");
|
||||
}
|
||||
|
||||
@ -109,7 +104,7 @@ public void Delete(IRestRequest request, HttpStatusCode statusCode = HttpStatusC
|
||||
|
||||
response.ErrorMessage.Should().BeBlank();
|
||||
|
||||
return _jsonSerializer.Deserialize<T>(response.Content);
|
||||
return Json.Deserialize<T>(response.Content);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,12 +1,11 @@
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Common;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Common.Serializer;
|
||||
using NzbDrone.Test.Common;
|
||||
|
||||
namespace NzbDrone.Libraries.Test.Json
|
||||
namespace NzbDrone.Libraries.Test.JsonTests
|
||||
{
|
||||
[TestFixture]
|
||||
public class JsonFixture : TestBase<JsonSerializer>
|
||||
public class JsonFixture : TestBase
|
||||
{
|
||||
public class TypeWithNumbers
|
||||
{
|
||||
@ -18,9 +17,9 @@ public void should_be_able_to_deserialize_numbers()
|
||||
{
|
||||
var quality = new TypeWithNumbers { Id = 12 };
|
||||
|
||||
var json = Subject.Serialize(quality);
|
||||
var json = Json.Serialize(quality);
|
||||
|
||||
Subject.Deserialize<TypeWithNumbers>(json);
|
||||
Json.Deserialize<TypeWithNumbers>(json);
|
||||
}
|
||||
}
|
||||
}
|
@ -45,7 +45,7 @@
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Json\JsonFixture.cs" />
|
||||
<Compile Include="JsonTests\JsonFixture.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
@ -65,6 +65,9 @@
|
||||
<Name>NzbDrone.Test.Common</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="Json\" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<Import Project="$(SolutionDir)\.nuget\nuget.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
|
@ -76,7 +76,6 @@ public void TestBaseSetup()
|
||||
|
||||
|
||||
Mocker.SetConstant(LogManager.GetLogger("TestLogger"));
|
||||
Mocker.SetConstant<IJsonSerializer>(new JsonSerializer());
|
||||
|
||||
LogManager.ReconfigExistingLoggers();
|
||||
|
||||
@ -147,17 +146,17 @@ protected string GetTestFilePath(string fileName)
|
||||
return Path.Combine(Directory.GetCurrentDirectory(), "Files", fileName);
|
||||
}
|
||||
|
||||
protected void VerifyEventPublished<TEvent>() where TEvent : IEvent
|
||||
protected void VerifyEventPublished<TEvent>() where TEvent : class, IEvent
|
||||
{
|
||||
VerifyEventPublished<TEvent>(Times.Once());
|
||||
}
|
||||
|
||||
protected void VerifyEventPublished<TEvent>(Times times) where TEvent : IEvent
|
||||
protected void VerifyEventPublished<TEvent>(Times times) where TEvent : class, IEvent
|
||||
{
|
||||
Mocker.GetMock<IMessageAggregator>().Verify(c => c.PublishEvent(It.IsAny<TEvent>()), times);
|
||||
}
|
||||
|
||||
protected void VerifyEventNotPublished<TEvent>() where TEvent : IEvent
|
||||
protected void VerifyEventNotPublished<TEvent>() where TEvent : class, IEvent
|
||||
{
|
||||
Mocker.GetMock<IMessageAggregator>().Verify(c => c.PublishEvent(It.IsAny<TEvent>()), Times.Never());
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user