AreAllTypesRegistered() public method

Determines whether all the specified types are registered with the service locator.
Note that this method is written for optimalization by the TypeFactory. This means that the TypeFactory does not need to call the ServiceLocator several times to construct a single type using dependency injection. Only use this method if you know what you are doing, otherwise use the IsTypeRegistered instead.
The is null.
public AreAllTypesRegistered ( ) : bool
return bool
コード例 #1
0
ファイル: ServiceLocatorFacts.cs プロジェクト: pars87/Catel
            public void ReturnsFalseWhenAtLeastOneTypeIsNotRegistered()
            {
                var serviceLocator = new ServiceLocator();

                serviceLocator.RegisterType<object>();
                serviceLocator.RegisterType<ITestInterface1, TestClass1>();

                Assert.IsFalse(serviceLocator.AreAllTypesRegistered(typeof(object), typeof(ITestInterface1), typeof(ITestInterface2)));
            }
コード例 #2
0
ファイル: ServiceLocatorFacts.cs プロジェクト: pars87/Catel
            public void ReturnsTrueWhenAllTypesAreRegistered()
            {
                var serviceLocator = new ServiceLocator();

                serviceLocator.RegisterType<object>();
                serviceLocator.RegisterType<ITestInterface1, TestClass1>();
                serviceLocator.RegisterType<ITestInterface2, TestClass2>();

                Assert.IsTrue(serviceLocator.AreAllTypesRegistered(typeof(object), typeof(ITestInterface1), typeof(ITestInterface2)));
            }
コード例 #3
0
ファイル: ServiceLocatorFacts.cs プロジェクト: pars87/Catel
            public void ThrowsArgumentExceptionForNullOrEmptyTypeArray()
            {
                var serviceLocator = new ServiceLocator();

                ExceptionTester.CallMethodAndExpectException<ArgumentException>(() => serviceLocator.AreAllTypesRegistered(null));
            }