public void TestRepositoryStorage()
        {
            PluginRepository testRepository = new PluginRepository();
            FactoryEmployer <PluginRepository> testEmployer = new FactoryEmployer <PluginRepository>();
            PluginHost testHost = new PluginHost(testEmployer, testRepository);

            Assert.AreSame(testRepository, testHost.Repository);
        }
        public void TestAssemblyLoadingWithEmployFailure()
        {
            PluginRepository testRepository = new PluginRepository();
            PluginHost       testHost       = new PluginHost(new FailingEmployer(), testRepository);

            // Might also use Assembly.GetCallingAssembly() here, but this leads to the exe of
            // the unit testing tool
            Assembly self = Assembly.GetAssembly(GetType());

            testRepository.AddAssembly(self);

            Assert.AreSame(testRepository, testHost.Repository);
        }
    public void TestFullConstructorWithPreloadedAssembly() {
      PluginRepository testRepository = new PluginRepository();
      FactoryEmployer<PluginRepository> testEmployer = new FactoryEmployer<PluginRepository>();

      // Might also use Assembly.GetCallingAssembly() here, but this leads to the exe of
      // the unit testing tool
      Assembly self = Assembly.GetAssembly(GetType());
      testRepository.AddAssembly(self);

      PluginHost testHost = new PluginHost(testEmployer, testRepository);

      Assert.AreSame(testEmployer, testHost.Employer);
      Assert.AreEqual(1, testEmployer.Factories.Count);
    }
        public void TestAssemblyLoadingWithNoPluginAttribute()
        {
            PluginRepository testRepository = new PluginRepository();
            FactoryEmployer <PluginHostTest> testEmployer = new FactoryEmployer <PluginHostTest>();
            PluginHost testHost = new PluginHost(testEmployer, testRepository);

            // Might also use Assembly.GetCallingAssembly() here, but this leads to the exe of
            // the unit testing tool
            Assembly self = Assembly.GetAssembly(GetType());

            testRepository.AddAssembly(self);

            Assert.AreSame(testRepository, testHost.Repository);
            Assert.AreEqual(0, testEmployer.Factories.Count);
        }
        public void TestFullConstructorWithPreloadedAssembly()
        {
            PluginRepository testRepository = new PluginRepository();
            FactoryEmployer <PluginRepository> testEmployer = new FactoryEmployer <PluginRepository>();

            // Might also use Assembly.GetCallingAssembly() here, but this leads to the exe of
            // the unit testing tool
            Assembly self = Assembly.GetAssembly(GetType());

            testRepository.AddAssembly(self);

            PluginHost testHost = new PluginHost(testEmployer, testRepository);

            Assert.AreSame(testEmployer, testHost.Employer);
            Assert.AreEqual(1, testEmployer.Factories.Count);
        }
    public void TestEmployerStorage() {
      PluginRepository testRepository = new PluginRepository();
      FactoryEmployer<PluginRepository> testEmployer = new FactoryEmployer<PluginRepository>();
      PluginHost testHost = new PluginHost(testEmployer, testRepository);

      Assert.AreSame(testEmployer, testHost.Employer);
    }
    public void TestAssemblyLoadingWithNoPluginAttribute() {
      PluginRepository testRepository = new PluginRepository();
      FactoryEmployer<PluginHostTest> testEmployer = new FactoryEmployer<PluginHostTest>();
      PluginHost testHost = new PluginHost(testEmployer, testRepository);

      // Might also use Assembly.GetCallingAssembly() here, but this leads to the exe of
      // the unit testing tool
      Assembly self = Assembly.GetAssembly(GetType());
      testRepository.AddAssembly(self);

      Assert.AreSame(testRepository, testHost.Repository);
      Assert.AreEqual(0, testEmployer.Factories.Count);
    }
    public void TestAssemblyLoadingWithEmployFailure() {
      PluginRepository testRepository = new PluginRepository();
      PluginHost testHost = new PluginHost(new FailingEmployer(), testRepository);

      // Might also use Assembly.GetCallingAssembly() here, but this leads to the exe of
      // the unit testing tool
      Assembly self = Assembly.GetAssembly(GetType());
      testRepository.AddAssembly(self);

      Assert.AreSame(testRepository, testHost.Repository);
    }