Commit b3aeb1a2 authored by Savorboard's avatar Savorboard

Refactoring namespace

parent 9f84d7bf
...@@ -8,6 +8,7 @@ using System.Text; ...@@ -8,6 +8,7 @@ using System.Text;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using DotNetCore.CAP.Messages; using DotNetCore.CAP.Messages;
using DotNetCore.CAP.Transport;
using Microsoft.Azure.ServiceBus; using Microsoft.Azure.ServiceBus;
using Microsoft.Azure.ServiceBus.Management; using Microsoft.Azure.ServiceBus.Management;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
......
// Copyright (c) .NET Core Community. All rights reserved. // Copyright (c) .NET Core Community. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information. // Licensed under the MIT License. See License.txt in the project root for license information.
using DotNetCore.CAP.Transport;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options; using Microsoft.Extensions.Options;
......
...@@ -3,6 +3,8 @@ ...@@ -3,6 +3,8 @@
using System.Reflection; using System.Reflection;
using DotNetCore.CAP.Dashboard.Pages; using DotNetCore.CAP.Dashboard.Pages;
using DotNetCore.CAP.Internal;
using DotNetCore.CAP.Transport;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
namespace DotNetCore.CAP.Dashboard namespace DotNetCore.CAP.Dashboard
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
using System; using System;
using DotNetCore.CAP; using DotNetCore.CAP;
using DotNetCore.CAP.Internal;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
namespace DotNetCore.CAP.Dashboard.NodeDiscovery namespace DotNetCore.CAP.Dashboard.NodeDiscovery
......
// Copyright (c) .NET Core Community. All rights reserved. // Copyright (c) .NET Core Community. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information. // Licensed under the MIT License. See License.txt in the project root for license information.
using DotNetCore.CAP.Internal;
namespace DotNetCore.CAP.Dashboard.NodeDiscovery namespace DotNetCore.CAP.Dashboard.NodeDiscovery
{ {
internal class ConsulProcessingNodeServer : IProcessingServer internal class ConsulProcessingNodeServer : IProcessingServer
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using DotNetCore.CAP.Transport;
namespace DotNetCore.CAP.InMemoryStorage namespace DotNetCore.CAP.InMemoryStorage
{ {
......
...@@ -8,6 +8,7 @@ using System.Text; ...@@ -8,6 +8,7 @@ using System.Text;
using System.Threading; using System.Threading;
using Confluent.Kafka; using Confluent.Kafka;
using DotNetCore.CAP.Messages; using DotNetCore.CAP.Messages;
using DotNetCore.CAP.Transport;
using Microsoft.Extensions.Options; using Microsoft.Extensions.Options;
namespace DotNetCore.CAP.Kafka namespace DotNetCore.CAP.Kafka
......
// Copyright (c) .NET Core Community. All rights reserved. // Copyright (c) .NET Core Community. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information. // Licensed under the MIT License. See License.txt in the project root for license information.
using DotNetCore.CAP.Transport;
using Microsoft.Extensions.Options; using Microsoft.Extensions.Options;
namespace DotNetCore.CAP.Kafka namespace DotNetCore.CAP.Kafka
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
using System.Diagnostics; using System.Diagnostics;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using DotNetCore.CAP.Transport;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using MongoDB.Driver; using MongoDB.Driver;
......
...@@ -5,6 +5,7 @@ using System.Data; ...@@ -5,6 +5,7 @@ using System.Data;
using System.Diagnostics; using System.Diagnostics;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using DotNetCore.CAP.Transport;
using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Storage; using Microsoft.EntityFrameworkCore.Storage;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
......
...@@ -5,6 +5,7 @@ using System.Data; ...@@ -5,6 +5,7 @@ using System.Data;
using System.Diagnostics; using System.Diagnostics;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using DotNetCore.CAP.Transport;
using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Storage; using Microsoft.EntityFrameworkCore.Storage;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
......
...@@ -6,6 +6,7 @@ using System.Collections.Generic; ...@@ -6,6 +6,7 @@ using System.Collections.Generic;
using System.Text; using System.Text;
using System.Threading; using System.Threading;
using DotNetCore.CAP.Messages; using DotNetCore.CAP.Messages;
using DotNetCore.CAP.Transport;
using Microsoft.Extensions.Options; using Microsoft.Extensions.Options;
using RabbitMQ.Client; using RabbitMQ.Client;
using RabbitMQ.Client.Events; using RabbitMQ.Client.Events;
......
// Copyright (c) .NET Core Community. All rights reserved. // Copyright (c) .NET Core Community. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information. // Licensed under the MIT License. See License.txt in the project root for license information.
using DotNetCore.CAP.Transport;
using Microsoft.Extensions.Options; using Microsoft.Extensions.Options;
namespace DotNetCore.CAP.RabbitMQ namespace DotNetCore.CAP.RabbitMQ
......
...@@ -6,6 +6,7 @@ using System.Collections.Concurrent; ...@@ -6,6 +6,7 @@ using System.Collections.Concurrent;
using System.Collections.Generic; using System.Collections.Generic;
using System.Reflection; using System.Reflection;
using DotNetCore.CAP.Persistence; using DotNetCore.CAP.Persistence;
using DotNetCore.CAP.Transport;
using Microsoft.Data.SqlClient; using Microsoft.Data.SqlClient;
namespace DotNetCore.CAP.SqlServer.Diagnostics namespace DotNetCore.CAP.SqlServer.Diagnostics
......
...@@ -6,6 +6,7 @@ using System.Collections.Concurrent; ...@@ -6,6 +6,7 @@ using System.Collections.Concurrent;
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics; using System.Diagnostics;
using DotNetCore.CAP.Persistence; using DotNetCore.CAP.Persistence;
using DotNetCore.CAP.Transport;
namespace DotNetCore.CAP.SqlServer.Diagnostics namespace DotNetCore.CAP.SqlServer.Diagnostics
{ {
......
...@@ -9,6 +9,7 @@ using System.Threading.Tasks; ...@@ -9,6 +9,7 @@ using System.Threading.Tasks;
using DotNetCore.CAP.Internal; using DotNetCore.CAP.Internal;
using DotNetCore.CAP.Persistence; using DotNetCore.CAP.Persistence;
using DotNetCore.CAP.SqlServer.Diagnostics; using DotNetCore.CAP.SqlServer.Diagnostics;
using DotNetCore.CAP.Transport;
using Microsoft.Data.SqlClient; using Microsoft.Data.SqlClient;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Infrastructure;
......
// Copyright (c) .NET Core Community. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
using System.Reflection;
using DotNetCore.CAP.Abstractions.ModelBinding;
namespace DotNetCore.CAP.Abstractions
{
/// <summary>
/// Model binder factory.
/// </summary>
public interface IModelBinderFactory
{
/// <summary>
/// Create a model binder by parameter.
/// </summary>
/// <param name="parameter">The method parameter info</param>
/// <returns>A model binder instance.</returns>
IModelBinder CreateBinder(ParameterInfo parameter);
}
}
\ No newline at end of file
// Copyright (c) .NET Core Community. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
using System.Threading.Tasks;
namespace DotNetCore.CAP.Abstractions.ModelBinding
{
/// <summary>
/// Defines an interface for model binders.
/// </summary>
public interface IModelBinder
{
Task<ModelBindingResult> BindModelAsync(string content);
}
}
\ No newline at end of file
// Copyright (c) .NET Core Community. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
using DotNetCore.CAP.Internal;
namespace DotNetCore.CAP.Abstractions.ModelBinding
{
/// <summary>
/// Contains the result of model binding.
/// </summary>
public struct ModelBindingResult
{
/// <summary>
/// Creates a <see cref="ModelBindingResult" /> representing a failed model binding operation.
/// </summary>
/// <returns>A <see cref="ModelBindingResult" /> representing a failed model binding operation.</returns>
public static ModelBindingResult Failed()
{
return new ModelBindingResult(null, false);
}
/// <summary>
/// Creates a <see cref="ModelBindingResult" /> representing a successful model binding operation.
/// </summary>
/// <param name="model">The model value. May be <c>null.</c></param>
/// <returns>A <see cref="ModelBindingResult" /> representing a successful model bind.</returns>
public static ModelBindingResult Success(object model)
{
return new ModelBindingResult(model, true);
}
private ModelBindingResult(object model, bool isSuccess)
{
Model = model;
IsSuccess = isSuccess;
}
/// <summary>
/// Gets the model associated with this context.
/// </summary>
public object Model { get; }
public bool IsSuccess { get; }
public override string ToString()
{
if (IsSuccess)
{
return $"Success '{Model}'";
}
return "Failed";
}
public override bool Equals(object obj)
{
var other = obj as ModelBindingResult?;
if (other == null)
{
return false;
}
return Equals(other.Value);
}
public override int GetHashCode()
{
var hashCodeCombiner = HashCodeCombiner.Start();
hashCodeCombiner.Add(IsSuccess);
hashCodeCombiner.Add(Model);
return hashCodeCombiner.CombinedHash;
}
public bool Equals(ModelBindingResult other)
{
return
IsSuccess == other.IsSuccess &&
Equals(Model, other.Model);
}
/// <summary>
/// Compares <see cref="ModelBindingResult" /> objects for equality.
/// </summary>
/// <param name="x">A <see cref="ModelBindingResult" />.</param>
/// <param name="y">A <see cref="ModelBindingResult" />.</param>
/// <returns><c>true</c> if the objects are equal, otherwise <c>false</c>.</returns>
public static bool operator ==(ModelBindingResult x, ModelBindingResult y)
{
return x.Equals(y);
}
/// <summary>
/// Compares <see cref="ModelBindingResult" /> objects for inequality.
/// </summary>
/// <param name="x">A <see cref="ModelBindingResult" />.</param>
/// <param name="y">A <see cref="ModelBindingResult" />.</param>
/// <returns><c>true</c> if the objects are not equal, otherwise <c>false</c>.</returns>
public static bool operator !=(ModelBindingResult x, ModelBindingResult y)
{
return !x.Equals(y);
}
}
}
\ No newline at end of file
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Collections.ObjectModel; using System.Collections.ObjectModel;
using DotNetCore.CAP.Abstractions; using DotNetCore.CAP.Internal;
// ReSharper disable once CheckNamespace // ReSharper disable once CheckNamespace
namespace DotNetCore.CAP namespace DotNetCore.CAP
......
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
// Licensed under the MIT License. See License.txt in the project root for license information. // Licensed under the MIT License. See License.txt in the project root for license information.
using System; using System;
using DotNetCore.CAP.Abstractions;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
namespace DotNetCore.CAP namespace DotNetCore.CAP
......
...@@ -3,10 +3,10 @@ ...@@ -3,10 +3,10 @@
using System; using System;
using DotNetCore.CAP; using DotNetCore.CAP;
using DotNetCore.CAP.Abstractions;
using DotNetCore.CAP.Internal; using DotNetCore.CAP.Internal;
using DotNetCore.CAP.Processor; using DotNetCore.CAP.Processor;
using DotNetCore.CAP.Serialization; using DotNetCore.CAP.Serialization;
using DotNetCore.CAP.Transport;
using Microsoft.Extensions.DependencyInjection.Extensions; using Microsoft.Extensions.DependencyInjection.Extensions;
// ReSharper disable once CheckNamespace // ReSharper disable once CheckNamespace
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using DotNetCore.CAP.Persistence; using DotNetCore.CAP.Persistence;
using DotNetCore.CAP.Transport;
namespace DotNetCore.CAP namespace DotNetCore.CAP
{ {
......
...@@ -4,9 +4,8 @@ ...@@ -4,9 +4,8 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Reflection; using System.Reflection;
using DotNetCore.CAP.Abstractions;
namespace DotNetCore.CAP namespace DotNetCore.CAP.Internal
{ {
/// <summary> /// <summary>
/// A descriptor of user definition method. /// A descriptor of user definition method.
......
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
// Licensed under the MIT License. See License.txt in the project root for license information. // Licensed under the MIT License. See License.txt in the project root for license information.
using System; using System;
using DotNetCore.CAP.Abstractions;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
namespace DotNetCore.CAP.Internal namespace DotNetCore.CAP.Internal
......
...@@ -9,10 +9,10 @@ using DotNetCore.CAP.Persistence; ...@@ -9,10 +9,10 @@ using DotNetCore.CAP.Persistence;
using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
namespace DotNetCore.CAP namespace DotNetCore.CAP.Internal
{ {
/// <summary> /// <summary>
/// Default implement of <see cref="T:DotNetCore.CAP.IBootstrapper" />. /// Default implement of <see cref="T:DotNetCore.CAP.Internal.IBootstrapper" />.
/// </summary> /// </summary>
internal class DefaultBootstrapper : BackgroundService, IBootstrapper internal class DefaultBootstrapper : BackgroundService, IBootstrapper
{ {
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace DotNetCore.CAP namespace DotNetCore.CAP.Internal
{ {
/// <summary> /// <summary>
/// Represents bootstrapping logic. For example, adding initial state to the storage or querying certain entities. /// Represents bootstrapping logic. For example, adding initial state to the storage or querying certain entities.
......
...@@ -7,14 +7,14 @@ using System.Diagnostics; ...@@ -7,14 +7,14 @@ using System.Diagnostics;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using DotNetCore.CAP.Diagnostics; using DotNetCore.CAP.Diagnostics;
using DotNetCore.CAP.Internal;
using DotNetCore.CAP.Messages; using DotNetCore.CAP.Messages;
using DotNetCore.CAP.Persistence; using DotNetCore.CAP.Persistence;
using DotNetCore.CAP.Transport;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
namespace DotNetCore.CAP.Abstractions namespace DotNetCore.CAP.Internal
{ {
public class CapPublisher : ICapPublisher internal class CapPublisher : ICapPublisher
{ {
private readonly IDispatcher _dispatcher; private readonly IDispatcher _dispatcher;
private readonly IDataStorage _storage; private readonly IDataStorage _storage;
......
...@@ -4,19 +4,17 @@ ...@@ -4,19 +4,17 @@
using System; using System;
using System.Diagnostics; using System.Diagnostics;
using System.Linq; using System.Linq;
using System.Text;
using System.Text.Json;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using DotNetCore.CAP.Diagnostics; using DotNetCore.CAP.Diagnostics;
using DotNetCore.CAP.Internal;
using DotNetCore.CAP.Messages; using DotNetCore.CAP.Messages;
using DotNetCore.CAP.Persistence; using DotNetCore.CAP.Persistence;
using DotNetCore.CAP.Serialization; using DotNetCore.CAP.Serialization;
using DotNetCore.CAP.Transport;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options; using Microsoft.Extensions.Options;
namespace DotNetCore.CAP namespace DotNetCore.CAP.Internal
{ {
internal class ConsumerRegister : IConsumerRegister internal class ConsumerRegister : IConsumerRegister
{ {
......
// Copyright (c) .NET Core Community. All rights reserved. // Copyright (c) .NET Core Community. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information. // Licensed under the MIT License. See License.txt in the project root for license information.
namespace DotNetCore.CAP namespace DotNetCore.CAP.Internal
{ {
/// <summary> /// <summary>
/// Handler received message of subscribed. /// Handler received message of subscribed.
......
...@@ -2,17 +2,15 @@ ...@@ -2,17 +2,15 @@
// Licensed under the MIT License. See License.txt in the project root for license information. // Licensed under the MIT License. See License.txt in the project root for license information.
using System; using System;
using System.Collections.Concurrent;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Reflection; using System.Reflection;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using DotNetCore.CAP.Abstractions;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using System.Collections.Concurrent;
using DotNetCore.CAP.Internal;
using Microsoft.Extensions.Options; using Microsoft.Extensions.Options;
namespace DotNetCore.CAP namespace DotNetCore.CAP.Internal
{ {
/// <inheritdoc /> /// <inheritdoc />
/// <summary> /// <summary>
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
using System.Collections.Generic; using System.Collections.Generic;
namespace DotNetCore.CAP namespace DotNetCore.CAP.Internal
{ {
/// <summary> /// <summary>
/// Defines an interface for selecting an consumer service method to invoke for the current message. /// Defines an interface for selecting an consumer service method to invoke for the current message.
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
using System; using System;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace DotNetCore.CAP.Abstractions namespace DotNetCore.CAP.Internal
{ {
public interface IMongoTransaction : IDisposable public interface IMongoTransaction : IDisposable
{ {
...@@ -14,8 +14,8 @@ namespace DotNetCore.CAP.Abstractions ...@@ -14,8 +14,8 @@ namespace DotNetCore.CAP.Abstractions
/// <value></value> /// <value></value>
bool AutoCommit { get; set; } bool AutoCommit { get; set; }
Task<IMongoTransaction> BegeinAsync(bool autoCommit = true); Task<IMongoTransaction> BeginAsync(bool autoCommit = true);
IMongoTransaction Begein(bool autoCommit = true); IMongoTransaction Begin(bool autoCommit = true);
} }
} }
\ No newline at end of file
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
using System; using System;
namespace DotNetCore.CAP namespace DotNetCore.CAP.Internal
{ {
/// <inheritdoc /> /// <inheritdoc />
/// <summary> /// <summary>
......
...@@ -7,15 +7,14 @@ using System.Diagnostics; ...@@ -7,15 +7,14 @@ using System.Diagnostics;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using DotNetCore.CAP.Diagnostics; using DotNetCore.CAP.Diagnostics;
using DotNetCore.CAP.Internal;
using DotNetCore.CAP.Messages; using DotNetCore.CAP.Messages;
using DotNetCore.CAP.Persistence; using DotNetCore.CAP.Persistence;
using DotNetCore.CAP.Processor; using DotNetCore.CAP.Processor;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options; using Microsoft.Extensions.Options;
using Microsoft.Extensions.DependencyInjection;
namespace DotNetCore.CAP namespace DotNetCore.CAP.Internal
{ {
internal class DefaultSubscriberExecutor : ISubscriberExecutor internal class DefaultSubscriberExecutor : ISubscriberExecutor
{ {
......
...@@ -5,7 +5,7 @@ using System.Threading; ...@@ -5,7 +5,7 @@ using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using DotNetCore.CAP.Persistence; using DotNetCore.CAP.Persistence;
namespace DotNetCore.CAP namespace DotNetCore.CAP.Internal
{ {
/// <summary> /// <summary>
/// Consumer executor /// Consumer executor
......
...@@ -5,7 +5,7 @@ using System; ...@@ -5,7 +5,7 @@ using System;
using System.Diagnostics.CodeAnalysis; using System.Diagnostics.CodeAnalysis;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
namespace DotNetCore.CAP namespace DotNetCore.CAP.Internal
{ {
[SuppressMessage("ReSharper", "InconsistentNaming")] [SuppressMessage("ReSharper", "InconsistentNaming")]
internal static class LoggerExtensions internal static class LoggerExtensions
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
using System; using System;
namespace DotNetCore.CAP.Abstractions namespace DotNetCore.CAP.Internal
{ {
/// <inheritdoc /> /// <inheritdoc />
/// <summary> /// <summary>
......
...@@ -10,6 +10,7 @@ namespace DotNetCore.CAP.Monitoring ...@@ -10,6 +10,7 @@ namespace DotNetCore.CAP.Monitoring
public MessageType MessageType { get; set; } public MessageType MessageType { get; set; }
public string Group { get; set; } public string Group { get; set; }
public string Name { get; set; } public string Name { get; set; }
public string Content { get; set; } public string Content { get; set; }
......
...@@ -7,6 +7,7 @@ using System.Threading; ...@@ -7,6 +7,7 @@ using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using DotNetCore.CAP.Internal; using DotNetCore.CAP.Internal;
using DotNetCore.CAP.Persistence; using DotNetCore.CAP.Persistence;
using DotNetCore.CAP.Transport;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
namespace DotNetCore.CAP.Processor namespace DotNetCore.CAP.Processor
......
...@@ -6,6 +6,7 @@ using System.Collections.Generic; ...@@ -6,6 +6,7 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using DotNetCore.CAP.Internal;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
using System; using System;
using System.Threading.Tasks; using System.Threading.Tasks;
using DotNetCore.CAP.Internal;
namespace DotNetCore.CAP.Processor namespace DotNetCore.CAP.Processor
{ {
......
...@@ -6,7 +6,7 @@ using System.Collections.Generic; ...@@ -6,7 +6,7 @@ using System.Collections.Generic;
using System.Threading; using System.Threading;
using DotNetCore.CAP.Messages; using DotNetCore.CAP.Messages;
namespace DotNetCore.CAP namespace DotNetCore.CAP.Transport
{ {
/// <inheritdoc /> /// <inheritdoc />
/// <summary> /// <summary>
......
// Copyright (c) .NET Core Community. All rights reserved. // Copyright (c) .NET Core Community. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information. // Licensed under the MIT License. See License.txt in the project root for license information.
namespace DotNetCore.CAP namespace DotNetCore.CAP.Transport
{ {
/// <summary> /// <summary>
/// Consumer client factory to create consumer client instance. /// Consumer client factory to create consumer client instance.
......
// Copyright (c) .NET Core Community. All rights reserved. // Copyright (c) .NET Core Community. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information. // Licensed under the MIT License. See License.txt in the project root for license information.
using DotNetCore.CAP.Internal;
using DotNetCore.CAP.Persistence; using DotNetCore.CAP.Persistence;
namespace DotNetCore.CAP namespace DotNetCore.CAP.Transport
{ {
public interface IDispatcher public interface IDispatcher
{ {
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
using System; using System;
namespace DotNetCore.CAP namespace DotNetCore.CAP.Transport
{ {
public enum MqLogType public enum MqLogType
{ {
......
using System.Linq;
using System.Reflection;
using DotNetCore.CAP.Abstractions;
using DotNetCore.CAP.Internal;
using Moq;
using Xunit;
namespace DotNetCore.CAP.Test
{
public class ModelBinderFactoryTest
{
private IModelBinderFactory _factory;
public ModelBinderFactoryTest()
{
var serializer = Mock.Of<IContentSerializer>();
_factory = new ModelBinderFactory(serializer);
}
[Theory]
[InlineData(nameof(Sample.DateTimeParam))]
[InlineData(nameof(Sample.StringParam))]
[InlineData(nameof(Sample.IntegerParam))]
[InlineData(nameof(Sample.GuidParam))]
[InlineData(nameof(Sample.UriParam))]
public void CreateSimpleTypeBinderTest(string methodName)
{
var methodInfo = typeof(Sample).GetRuntimeMethods().Single(x => x.Name == methodName);
var binder = _factory.CreateBinder(methodInfo.GetParameters()[0]);
Assert.NotNull(binder);
Assert.True(binder is SimpleTypeModelBinder);
Assert.False(binder is ComplexTypeModelBinder);
}
[Theory]
[InlineData(nameof(Sample.ComplexTypeParam))]
public void CreateComplexTypeBinderTest(string methodName)
{
var methodInfo = typeof(Sample).GetRuntimeMethods().Single(x => x.Name == methodName);
var binder = _factory.CreateBinder(methodInfo.GetParameters()[0]);
Assert.NotNull(binder);
Assert.False(binder is SimpleTypeModelBinder);
Assert.True(binder is ComplexTypeModelBinder);
}
}
}
\ No newline at end of file
using System.Linq; using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
using DotNetCore.CAP.Infrastructure; using DotNetCore.CAP.Internal;
using Xunit; using Xunit;
namespace DotNetCore.CAP.Test namespace DotNetCore.CAP.Test
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment