Beispiel #1
0
        public static IStakhanoviseSetup WithNLogLogging(this IStakhanoviseSetup setup)
        {
            if (setup == null)
            {
                throw new ArgumentNullException(nameof(setup));
            }

            return(setup.WithLoggingProvider(new NLogLoggingProvider()));
        }
Beispiel #2
0
        public static IStakhanoviseSetup WithNinjectIoCResolver(this IStakhanoviseSetup setup)
        {
            if (setup == null)
            {
                throw new ArgumentNullException(nameof(setup));
            }

            return(setup.WithNinjectIoCResolver(new NInjectDependencyResolver()));
        }
Beispiel #3
0
 private static IStakhanoviseSetup WithNinjectIoCResolver(this IStakhanoviseSetup setup,
                                                          NInjectDependencyResolver resolver)
 {
     return(setup.SetupTaskExecutorRegistry(registrySetup =>
     {
         registrySetup.SetupBuiltInTaskExecutorRegistry(builtInRegistrySetup =>
         {
             builtInRegistrySetup.WithResolver(resolver);
         });
     }));
 }
Beispiel #4
0
        public static IStakhanoviseSetup WithNinjectIoCResolver(this IStakhanoviseSetup setup,
                                                                IEnumerable <INinjectModule> existingModules)
        {
            if (setup == null)
            {
                throw new ArgumentNullException(nameof(setup));
            }

            if (existingModules == null)
            {
                throw new ArgumentNullException(nameof(existingModules));
            }

            return(setup.WithNinjectIoCResolver(new NInjectDependencyResolver(existingModules)));
        }
Beispiel #5
0
        public void Test_CanRegisterLoggingProvider_NonNullTargetSetup()
        {
            Mock <IStakhanoviseSetup> setupMock =
                CreateSetupMock();

            IStakhanoviseSetup targetSetup =
                setupMock.Object;

            IStakhanoviseSetup chainedSetup =
                targetSetup.WithLog4NetLogging();

            Assert.AreSame(targetSetup,
                           chainedSetup);

            setupMock.VerifyAll();
            setupMock.VerifyNoOtherCalls();
        }
        public static IStakhanoviseSetup SetupBuiltInTaskExecutorRegistryDependencies(this IStakhanoviseSetup stakhanoviseSetup,
                                                                                      Action <IDependencySetup> setupAction)
        {
            if (stakhanoviseSetup == null)
            {
                throw new ArgumentNullException(nameof(stakhanoviseSetup));
            }

            if (setupAction == null)
            {
                throw new ArgumentNullException(nameof(setupAction));
            }

            return(stakhanoviseSetup.SetupTaskExecutorRegistry(execRegSetup =>
                                                               execRegSetup.SetupBuiltInTaskExecutorRegistry(builtInExecRegSetup =>
                                                                                                             builtInExecRegSetup.SetupDependencies(setupAction)
                                                                                                             )
                                                               ));
        }
        public static IStakhanoviseSetup WithBuiltInTaskExecutorRegistryDependencyResolver(this IStakhanoviseSetup stakhanoviseSetup,
                                                                                           IDependencyResolver resolver)
        {
            if (stakhanoviseSetup == null)
            {
                throw new ArgumentNullException(nameof(stakhanoviseSetup));
            }

            return(stakhanoviseSetup.SetupTaskExecutorRegistry(execRegSetup =>
                                                               execRegSetup.SetupBuiltInTaskExecutorRegistry(builtInExecRegSetup =>
                                                                                                             builtInExecRegSetup.WithResolver(resolver)
                                                                                                             )
                                                               ));
        }
Beispiel #8
0
        public void Test_CanRegisterLoggingProvider_NullTargetSetup()
        {
            IStakhanoviseSetup targetSetup = null;

            Assert.Throws <ArgumentNullException>(() => targetSetup.WithLog4NetLogging());
        }