예제 #1
0
        public void TestAddAssembly()
        {
            PluginRepository testRepository = new 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);

            Assert.AreEqual(1, testRepository.LoadedAssemblies.Count);
        }
예제 #2
0
        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);
        }
예제 #3
0
    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);
    }
예제 #4
0
        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);
        }
예제 #5
0
        public void TestAssemblyLoadedEvent()
        {
            Mockery mockery = new Mockery();

            PluginRepository          testRepository = new PluginRepository();
            IAssemblyLoadedSubscriber subscriber     = mockSubscriber(mockery, testRepository);

            Expect.Once.On(subscriber).Method("AssemblyLoaded").WithAnyArguments();

            Assembly self = Assembly.GetAssembly(GetType());

            testRepository.AddAssembly(self);

            mockery.VerifyAllExpectationsHaveBeenMet();
        }
예제 #6
0
        public void TestAssemblyLoadedEvent()
        {
            MockFactory mockery = new MockFactory();

            PluginRepository testRepository             = new PluginRepository();
            Mock <IAssemblyLoadedSubscriber> subscriber = mockSubscriber(mockery, testRepository);

            subscriber.Expects.One.Method(m => m.AssemblyLoaded(null, null)).WithAnyArguments();

            Assembly self = Assembly.GetAssembly(GetType());

            testRepository.AddAssembly(self);

            mockery.VerifyAllExpectationsHaveBeenMet();
        }
예제 #7
0
        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 TestAssemblyLoadedEvent() {
      Mockery mockery = new Mockery();

      PluginRepository testRepository = new PluginRepository();
      IAssemblyLoadedSubscriber subscriber = mockSubscriber(mockery, testRepository);

      Expect.Once.On(subscriber).Method("AssemblyLoaded").WithAnyArguments();

      Assembly self = Assembly.GetAssembly(GetType());
      testRepository.AddAssembly(self);

      mockery.VerifyAllExpectationsHaveBeenMet();
    }
    public void TestAddAssembly() {
      PluginRepository testRepository = new 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);

      Assert.AreEqual(1, testRepository.LoadedAssemblies.Count);
    }
예제 #10
0
    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);
    }
예제 #11
0
    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);
    }