Your ROOT_URL in app.ini is https://git.cloudchain.link/ but you are visiting https://dash.bss.nz/open-source-mirrors/Readarr/src/commit/79a0f09b437ad11814da50809f798a91cdb8353e/NzbDrone.Core.Test/Ninject.Moq/ExtensionsForBindingSyntax.cs You should set ROOT_URL correctly, otherwise the web may not work correctly.
Readarr/NzbDrone.Core.Test/Ninject.Moq/ExtensionsForBindingSyntax.cs

34 lines
1.1 KiB

using System;
using Ninject.Infrastructure;
using Ninject.Injection;
using Ninject.Planning.Bindings;
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()));
IBinding binding = haveBinding.Binding;
binding.ProviderCallback = ctx => new MockProvider(ctx.Kernel.Components.Get<IInjectorFactory>());
return builder as IBindingWhenInNamedWithOrOnSyntax<T>;
}
}
}