本文整理匯總了C#中Ninject.StandardKernel.GetModules方法的典型用法代碼示例。如果您正苦於以下問題:C# StandardKernel.GetModules方法的具體用法?C# StandardKernel.GetModules怎麽用?C# StandardKernel.GetModules使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Ninject.StandardKernel
的用法示例。
在下文中一共展示了StandardKernel.GetModules方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: CanGetBackRegisteredModules
public void CanGetBackRegisteredModules()
{
var kernel = new StandardKernel();
var module = new VeggieModule();
kernel.Load(module);
Assert.That(kernel.GetModules(), Has.Member(module));
}
示例2: Deve_retornar_um_modulo
public void Deve_retornar_um_modulo()
{
// Instancia o módulo;
var modulo = new Modulo();
// Cria o kernel principal com o módulo;
IKernel kernel = new StandardKernel(modulo);
// Obtém os módulos do kernel;
var modulos = kernel.GetModules().ToList();
// Só devemos ter um módulo registrado;
Assert.AreEqual(1, modulos.Count());
// O módulo que
CollectionAssert.Contains(modulos, modulo);
}
示例3: Run
public static int Run(string jobName)
{
var result = 0;
using (var kernel =
new StandardKernel())
{
kernel.Load(NinjectDllsToLoadMask);
Debug.Assert(kernel.GetModules().Any());
var log = kernel.Get<ILogProvider>();
try
{
var jobConfig =
XDocument.Load(jobName + JobConfigurationFileExtension);
var aJob = new Job(jobName, jobConfig, kernel, log);
aJob.Execute();
result = aJob.Result;
if (!aJob.Successful)
{
log.WithLogLevel(LogLevel.Error)
.WriteMessage("{0} failed.", aJob.Name);
}
}
catch (Exception ex)
{
log.WithLogLevel(LogLevel.Error)
.WriteGeneralException(ex);
result = -1;
}
}
return result;
}