public NuGetModuleFixture() { Registrar = Substitute.For <ICakeContainerRegistrar>(); Builder = Substitute.For <ICakeRegistrationBuilder>(); Registrar.RegisterType <T>().Returns(Builder); Builder.As(Arg.Any <Type>()).Returns(Builder); Builder.Singleton().Returns(Builder); Builder.Transient().Returns(Builder); Builder.AsSelf().Returns(Builder); }
/// <summary> /// Adds a registration type to an existing registration builder. /// </summary> /// <typeparam name="TRegistration">The registration type.</typeparam> /// <param name="builder">The registration builder.</param> /// <returns>The same <see cref="ICakeRegistrationBuilder"/> instance so that multiple calls can be chained.</returns> public static ICakeRegistrationBuilder As <TRegistration>(this ICakeRegistrationBuilder builder) { return(builder.As(typeof(TRegistration))); }