예제 #1
0
        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);
        }
예제 #2
0
 /// <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)));
 }