public void CollectionPropertyEmptyKey()
        {
            ServiceLocatorConfiguration configuration = ServiceLocatorConfigurationTests.LoadConfiguration("DelayStrategiesEmptyKey.config");

            CollectionPropertyConfigurationElement configElement = configuration.Services
                                                                   .OfType <ServiceConfigurationElement>()
                                                                   .Last()
                                                                   .ImplementationProperties
                                                                   .OfType <CollectionPropertyConfigurationElement>()
                                                                   .Single();

            Assert.AreEqual(0, configElement.ResolveKeys.Count);
        }
        public void CollectionPropertyNoKeys()
        {
            ServiceLocatorConfiguration configuration = ServiceLocatorConfigurationTests.LoadConfiguration("DelayStrategiesNoKeys.config");

            CollectionPropertyConfigurationElement configElement = configuration.Services
                                                                   .OfType <ServiceConfigurationElement>()
                                                                   .Last()
                                                                   .ImplementationProperties
                                                                   .OfType <CollectionPropertyConfigurationElement>()
                                                                   .Single();

            Assert.IsNull(configElement.ResolveKeys);
        }
        public void PropertyValue()
        {
            ServiceLocatorConfiguration configuration = ServiceLocatorConfigurationTests.LoadConfiguration("TimerWithInterval.config");

            ValuePropertyConfigurationElement configElement = configuration.Services
                                                              .OfType <ServiceConfigurationElement>()
                                                              .Single()
                                                              .ImplementationProperties
                                                              .OfType <ValuePropertyConfigurationElement>()
                                                              .Single();

            Assert.AreEqual("00:15:00", configElement.ValueAsString);

            Assert.AreEqual(TimeSpan.FromMinutes(15), configElement.ConvertedValue);
        }
        public void ConstructorValueParameter()
        {
            ServiceLocatorConfiguration configuration = ServiceLocatorConfigurationTests.LoadConfiguration("ConstantDelayStrategy.config");

            ConstructorValueConfigurationElement configElement = configuration.Services
                                                                 .OfType <ServiceConfigurationElement>()
                                                                 .Single()
                                                                 .ImplementationConstructorParameters
                                                                 .OfType <ConstructorValueConfigurationElement>()
                                                                 .Single();

            Assert.AreEqual("00:15:00", configElement.ValueAsString);

            Assert.AreEqual(TimeSpan.FromMinutes(15), configElement.ConvertedValue);
        }
        public void CollectionPropertyTwoKeys()
        {
            ServiceLocatorConfiguration configuration = ServiceLocatorConfigurationTests.LoadConfiguration("DelayStrategiesTwoKeys.config");

            CollectionPropertyConfigurationElement configElement = configuration.Services
                                                                   .OfType <ServiceConfigurationElement>()
                                                                   .Last()
                                                                   .ImplementationProperties
                                                                   .OfType <CollectionPropertyConfigurationElement>()
                                                                   .Single();

            Assert.AreEqual(2, configElement.ResolveKeys.Count);

            Assert.AreEqual("None", configElement.ResolveKeys[0]);
            Assert.AreEqual("Exponential", configElement.ResolveKeys[1]);
        }
        public void ConstructorResolveParameterByKey()
        {
            ServiceLocatorConfiguration configuration = ServiceLocatorConfigurationTests.LoadConfiguration("DateTimeProviderWithValidTimerKey.config");

            ServiceConfigurationElement serviceConfig = configuration.Services
                                                        .OfType <ServiceConfigurationElement>()
                                                        .Last();

            Assert.IsNotNull(serviceConfig.ImplementationConstructorParameters.ResolvedConstructorInfo);

            ConstructorResolveConfigurationElement configElement = serviceConfig.ImplementationConstructorParameters
                                                                   .OfType <ConstructorResolveConfigurationElement>()
                                                                   .Single();

            Assert.AreEqual("MyTimer", configElement.ResolveKey);
        }
 public void ConfigSourceNotFound()
 {
     ServiceLocatorConfigurationTests.LoadConfiguration("ConfigSourceNotFound.config");
 }
 public void ConfigSourcesDuplicateKey()
 {
     ServiceLocatorConfigurationTests.LoadConfiguration("ConfigSourcesDuplicateKey.config");
 }
 public void CollectionPropertyDependencyValues()
 {
     ServiceLocatorConfigurationTests.LoadConfiguration("CollectionPropertyDependencyValues.config");
 }
コード例 #10
0
 public void RegisterLocatorAsService()
 {
     ServiceLocatorConfigurationTests.LoadConfiguration("RegisterLocatorAsService.config");
 }
コード例 #11
0
 public void MultipleContractsWithoutKeys()
 {
     ServiceLocatorConfigurationTests.LoadConfiguration("MultipleTimersWithoutKeys.config");
 }
コード例 #12
0
 public void ImplementationTypeIsNotCollection()
 {
     ServiceLocatorConfigurationTests.LoadConfiguration("CompositionNoCollection.config");
 }
コード例 #13
0
 public void DuplicateKeys()
 {
     ServiceLocatorConfigurationTests.LoadConfiguration("DuplicateKeys.config");
 }
コード例 #14
0
 public void AbstractImplementationType()
 {
     ServiceLocatorConfigurationTests.LoadConfiguration("AbstractImplementationType.config");
 }
コード例 #15
0
 public void MultiplePublicConstructors()
 {
     ServiceLocatorConfigurationTests.LoadConfiguration("MultiplePublicConstructors.config");
 }
コード例 #16
0
 public void ContractNotAssignable()
 {
     ServiceLocatorConfigurationTests.LoadConfiguration("ContractNotAssignable.config");
 }
コード例 #17
0
 public void NoPublicConstructor()
 {
     ServiceLocatorConfigurationTests.LoadConfiguration("NoPublicConstructor.config");
 }
コード例 #18
0
 public void DependencyNotFound()
 {
     ServiceLocatorConfigurationTests.LoadConfiguration("DateTimeProviderNoTimer.config");
 }
コード例 #19
0
 public void CompositionResolveKeysNone()
 {
     ServiceLocatorConfigurationTests.LoadConfiguration("CompositionResolveKeysNone.config");
 }
コード例 #20
0
 public void CompositionResolveUnkownKey()
 {
     ServiceLocatorConfigurationTests.LoadConfiguration("CompositionResolveUnkownKey.config");
 }
コード例 #21
0
 public void ConstructorResolveParameterWithInvalidKey()
 {
     ServiceLocatorConfigurationTests.LoadConfiguration("DateTimeProviderWithInvalidTimerKey.config");
 }