public void ProvidersAreCheckedDependingOnTheConfigureAttributePrecedence()
        {
            // Arrange
            var provider1 = new GoodMockConfigurationMethodProvider();
            var provider2 = new GoodMockConfigurationMethodProvider2();
            provider1.ConfigureAttributeTypesSupported = new Type[] { typeof(HighPrecedenceConfigureAttribute) };
            provider2.ConfigureAttributeTypesSupported = new Type[] { typeof(LowPrecedenceConfigureAttribute) };
            Configure.TheEnvironment.AddConfigurationMethod(provider1);
            Configure.TheEnvironment.AddConfigurationMethod(provider2);
            int provider1Step = 0;
            int provider2Step = 0;
            int callCount = 0;
            provider1.TryPopulateBehaviour = (configurationInstance, propertyInfo, attribute) => { if (provider1Step != 0) { Assert.Fail(); } provider1Step = ++callCount; return false; };
            provider2.TryPopulateBehaviour = (configurationInstance, propertyInfo, attribute) => { if (provider2Step != 0) { Assert.Fail(); } provider2Step = ++callCount; return false; };

            // Action
            var configuration1 = Configure.Get<IPrecedenceTestConfiguration>(); // No Provider to be called.
            Assert.AreEqual(2, callCount);
            Assert.AreEqual(1, provider1Step);
            Assert.AreEqual(2, provider2Step);
        }
        public void CorrectProviderIsCalledDependingOnConfigureAttributeType()
        {
            // Arrange
            var provider1 = new GoodMockConfigurationMethodProvider();
            var provider2 = new GoodMockConfigurationMethodProvider2();
            Configure.TheEnvironment.AddConfigurationMethod(provider1);
            Configure.TheEnvironment.AddConfigurationMethod(provider2);
            int provider1CallCount = 0;
            int provider2CallCount = 0;
            provider1.TryPopulateBehaviour = (configurationInstance, propertyInfo, attribute) => { provider1CallCount++; return true; };
            provider2.TryPopulateBehaviour = (configurationInstance, propertyInfo, attribute) => { provider2CallCount++; return true; };

            // Action
            provider1CallCount = 0;
            provider2CallCount = 0;
            var configuration1 = Configure.Get<IMyTestConfiguration>(); // No Provider to be called.
            Assert.AreEqual(0, provider1CallCount);
            Assert.AreEqual(0, provider2CallCount);

            provider1CallCount = 0;
            provider2CallCount = 0;
            var configuration2 = Configure.Get<IMyTestConfiguration2>(); // Expect provider 2 to be called.
            Assert.AreEqual(1, provider1CallCount);
            Assert.AreEqual(0, provider2CallCount);

            provider1CallCount = 0;
            provider2CallCount = 0;
            var configuration3 = Configure.Get<IMyTestConfiguration3>(); // Expect both to be called
            Assert.AreEqual(1, provider1CallCount);
            Assert.AreEqual(1, provider2CallCount);
        }