mirror of
https://github.com/lidarr/lidarr.git
synced 2025-08-14 02:37:08 -07:00
ReSharper code cleanup
This commit is contained in:
parent
8cade435d1
commit
e896af5cd0
138 changed files with 2368 additions and 2218 deletions
|
@ -6,28 +6,31 @@ using Ninject.Syntax;
|
|||
|
||||
namespace Ninject.Moq
|
||||
{
|
||||
/// <summary>
|
||||
/// Extensions for the fluent binding syntax API.
|
||||
/// </summary>
|
||||
public static class ExtensionsForBindingSyntax
|
||||
{
|
||||
/// <summary>
|
||||
/// Indicates that the service should be bound to a mocked instance of the specified type.
|
||||
/// </summary>
|
||||
/// <typeparam name="T">The service that is being mocked.</typeparam>
|
||||
/// <param name="builder">The builder that is building the binding.</param>
|
||||
public static IBindingWhenInNamedWithOrOnSyntax<T> ToMock<T>(this IBindingToSyntax<T> builder)
|
||||
{
|
||||
var haveBinding = builder as IHaveBinding;
|
||||
|
||||
if (haveBinding == null)
|
||||
throw new NotSupportedException(String.Format("The binding builder for {0} is of type {1}, which does not implement IHaveBinding and is therefore not extensible.", typeof(T), builder.GetType()));
|
||||
/// <summary>
|
||||
/// Extensions for the fluent binding syntax API.
|
||||
/// </summary>
|
||||
public static class ExtensionsForBindingSyntax
|
||||
{
|
||||
/// <summary>
|
||||
/// Indicates that the service should be bound to a mocked instance of the specified type.
|
||||
/// </summary>
|
||||
/// <typeparam name = "T">The service that is being mocked.</typeparam>
|
||||
/// <param name = "builder">The builder that is building the binding.</param>
|
||||
public static IBindingWhenInNamedWithOrOnSyntax<T> ToMock<T>(this IBindingToSyntax<T> builder)
|
||||
{
|
||||
var haveBinding = builder as IHaveBinding;
|
||||
|
||||
IBinding binding = haveBinding.Binding;
|
||||
if (haveBinding == null)
|
||||
throw new NotSupportedException(
|
||||
String.Format(
|
||||
"The binding builder for {0} is of type {1}, which does not implement IHaveBinding and is therefore not extensible.",
|
||||
typeof (T), builder.GetType()));
|
||||
|
||||
binding.ProviderCallback = ctx => new MockProvider(ctx.Kernel.Components.Get<IInjectorFactory>());
|
||||
IBinding binding = haveBinding.Binding;
|
||||
|
||||
return builder as IBindingWhenInNamedWithOrOnSyntax<T>;
|
||||
}
|
||||
}
|
||||
}
|
||||
binding.ProviderCallback = ctx => new MockProvider(ctx.Kernel.Components.Get<IInjectorFactory>());
|
||||
|
||||
return builder as IBindingWhenInNamedWithOrOnSyntax<T>;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue