Exemple #1
0
        public void TestLateAdd()
        {
            RepositoryTypeLister testLister = new RepositoryTypeLister();

            testLister.Repository.AddAssembly(typeof(RepositoryTypeListerTest).Assembly);

            Assert.That(
                testLister.GetTypes(),
                Has.Member(typeof(RepositoryTypeListerTest))
                );
        }
        public void TestGetComponentOnValueType()
        {
            RepositoryTypeLister typeLister     = new RepositoryTypeLister();
            ServiceManager       serviceManager = new ServiceManager(typeLister);

            typeLister.Repository.AddAssembly(typeof(int).Assembly);

            Assert.Throws <ArgumentException>(
                delegate() { serviceManager.GetService(typeof(int)); }
                );
        }
        public void TestGetComponents()
        {
            RepositoryTypeLister typeLister     = new RepositoryTypeLister();
            ServiceManager       serviceManager = new ServiceManager(typeLister);

            typeLister.Repository.AddAssembly(typeof(ServiceManagerTest).Assembly);

            Assert.That(
                serviceManager.GetComponents <IHelloContract>(),
                Has.Member(typeof(HelloComponent)).And.Member(typeof(WorldComponent))
                );
        }
        public void TestFilteredGetComponents()
        {
            RepositoryTypeLister typeLister     = new RepositoryTypeLister();
            ServiceManager       serviceManager = new ServiceManager(typeLister);

            typeLister.Repository.AddAssembly(typeof(ServiceManagerTest).Assembly);

            Assert.That(
                serviceManager.GetComponents <IWorldContract>(false),
                Has.Member(typeof(WorldComponent)).And.Member(typeof(IncompleteComponent))
                );
            Assert.That(
                serviceManager.GetComponents <IWorldContract>(true),
                Has.Member(typeof(WorldComponent)).And.No.Member(typeof(IncompleteComponent))
                );
        }
Exemple #5
0
        public void TestEmptyLister()
        {
            RepositoryTypeLister testLister = new RepositoryTypeLister();

            Assert.That(testLister.GetTypes(), Is.Empty);
        }