public void LoadTypeMappingsNullEmuneration_Test()
        {
            ActivatingServiceLocatorFactory factory = new ActivatingServiceLocatorFactory();
            IServiceLocator servicelocator          = factory.Create();

            factory.LoadTypeMappings(servicelocator, null);
        }
        public void ServiceLocatorFactory_CreateTest()
        {
            ActivatingServiceLocatorFactory factory = new ActivatingServiceLocatorFactory();
            IServiceLocator servicelocator          = factory.Create();

            Assert.AreEqual(servicelocator.GetType().ToString(), typeof(ActivatingServiceLocator).ToString(),
                            "ActivatingServiceLocatorFactory create method failed to craete an object of type ActivatingServiceLocator");
        }
示例#3
0
        public void FactoryCreatesServiceLocator()
        {
            var target = new ActivatingServiceLocatorFactory();

            ActivatingServiceLocator serviceLocator = target.Create() as ActivatingServiceLocator;

            Assert.IsNotNull(serviceLocator);
        }
        public void TypeMappingsNullDoesNotThrow()
        {
            //Arrange
            var target = new ActivatingServiceLocatorFactory();

            //Act
            target.LoadTypeMappings(new ActivatingServiceLocator(), null);

            //Assert is by not having the exception thrown.
        }
        public void LoadTypeMappings3_Test()
        {
            ActivatingServiceLocatorFactory factory = new ActivatingServiceLocatorFactory();
            IServiceLocator servicelocator          = factory.Create();

            List <TypeMapping> typeMappings = new List <TypeMapping>();

            typeMappings.Add(new TypeMapping());

            factory.LoadTypeMappings(servicelocator, typeMappings);
        }
        public void FactoryCreatesServiceLocator()
        {
            //Arrange
            var target = new ActivatingServiceLocatorFactory();

            //Act
            var serviceLocator = target.Create() as ActivatingServiceLocator;

            //Assert
            Assert.IsNotNull(serviceLocator);
        }
        public void ThrowOnInvalidLocatorType()
        {
            //Arrange
            var target = new ActivatingServiceLocatorFactory();

            //Act
            target.LoadTypeMappings(
                new SServiceLocatorImplBase(),
                new List <TypeMapping>());

            // Assert
            // throw
        }
示例#8
0
        public void CanLoadTypeMappings()
        {
            var target = new ActivatingServiceLocatorFactory();

            List <TypeMapping> typeMappings = new List <TypeMapping>();

            typeMappings.Add(TypeMapping.Create <ISomething, Something>());

            var serviceLocator = new ActivatingServiceLocator();

            target.LoadTypeMappings(serviceLocator, typeMappings);

            Assert.IsTrue(serviceLocator.IsTypeRegistered <ISomething>());
        }
        public void LoadTypeMappings2_Test()
        {
            ActivatingServiceLocatorFactory factory = new ActivatingServiceLocatorFactory();
            IServiceLocator servicelocator          = factory.Create();

            List <TypeMapping> typeMappings = new List <TypeMapping>();

            typeMappings.Add(new TypeMapping(typeof(IInterface1), typeof(FirstClass1), null));

            factory.LoadTypeMappings(servicelocator, typeMappings);
            ActivatingServiceLocator AserviceLoc = servicelocator as ActivatingServiceLocator;

            Assert.IsTrue(AserviceLoc.IsTypeRegistered <IInterface1>(), "Failed to register the type");
            object FirstClass1Object = AserviceLoc.GetInstance(typeof(IInterface1));

            Assert.AreEqual(FirstClass1Object.GetType().Name, "FirstClass1");
        }
示例#10
0
        public void TypeMappingsNullDoesNotThrow()
        {
            var target = new ActivatingServiceLocatorFactory();

            target.LoadTypeMappings(new ActivatingServiceLocator(), null);
        }