Exemplo n.º 1
0
        public void KnownApplicationNameTest(string appName, string fqdn)
        {
            Assembly asm = Assembly.GetExecutingAssembly();

            var logger = new Mock <ILoggerFactory>().Object;

            FactoryApplicationContext.SetLoggerFactory(logger);

            FactoryApplicationContext.ClearRegisteredItems();
            FactoryApplicationContext.RegisterApplication(asm, appName, fqdn);

            var items = new Dictionary <string, PluginEntry>();

            for (int i = 1; i <= 5; i++)
            {
                string key   = string.Format("{0}_{1}", appName, i);
                var    entry = new PluginEntry(asm, key, fqdn);

                items.Add(key, entry);
            }

            FactoryApplicationContext.RegisterApplications(items);

            IApplication opt = FactoryApplicationContext.CreateApplicationObject(appName);

            Assert.IsNotNull(opt, "Object must not be null!!!");
        }
Exemplo n.º 2
0
 public void UnknownApplicationNameTest(string appName)
 {
     try
     {
         IApplication opt = FactoryApplicationContext.CreateApplicationObject(appName);
         Assert.True(false, "Exception shoud be throw for unknow application name!!!");
     }
     catch (Exception e)
     {
         Assert.True(true, e.Message);
     }
 }