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");
 }
 public void RegisterLocatorAsService()
 {
     ServiceLocatorConfigurationTests.LoadConfiguration("RegisterLocatorAsService.config");
 }
 public void MultipleContractsWithoutKeys()
 {
     ServiceLocatorConfigurationTests.LoadConfiguration("MultipleTimersWithoutKeys.config");
 }
 public void ImplementationTypeIsNotCollection()
 {
     ServiceLocatorConfigurationTests.LoadConfiguration("CompositionNoCollection.config");
 }
 public void DuplicateKeys()
 {
     ServiceLocatorConfigurationTests.LoadConfiguration("DuplicateKeys.config");
 }
 public void AbstractImplementationType()
 {
     ServiceLocatorConfigurationTests.LoadConfiguration("AbstractImplementationType.config");
 }
 public void MultiplePublicConstructors()
 {
     ServiceLocatorConfigurationTests.LoadConfiguration("MultiplePublicConstructors.config");
 }
 public void ContractNotAssignable()
 {
     ServiceLocatorConfigurationTests.LoadConfiguration("ContractNotAssignable.config");
 }
 public void NoPublicConstructor()
 {
     ServiceLocatorConfigurationTests.LoadConfiguration("NoPublicConstructor.config");
 }
 public void DependencyNotFound()
 {
     ServiceLocatorConfigurationTests.LoadConfiguration("DateTimeProviderNoTimer.config");
 }
 public void CompositionResolveKeysNone()
 {
     ServiceLocatorConfigurationTests.LoadConfiguration("CompositionResolveKeysNone.config");
 }
 public void CompositionResolveUnkownKey()
 {
     ServiceLocatorConfigurationTests.LoadConfiguration("CompositionResolveUnkownKey.config");
 }
 public void ConstructorResolveParameterWithInvalidKey()
 {
     ServiceLocatorConfigurationTests.LoadConfiguration("DateTimeProviderWithInvalidTimerKey.config");
 }