コード例 #1
0
 public void Initialize()
 {
     _configurationChangedVisited = false;
     _before = null;
     _after  = null;
     TypeResolver.Configure((ITypeResolver)null);
     TypeResolver.ConfigurationChanged += TypeResolverConfigurationChanged;
 }
コード例 #2
0
        public void ConfigurationFromAppConfigWorks()
        {
            // --- Arrange
            var before = TypeResolver.Current;

            TypeResolver.Configure(SECTION_NAME);
            var after = TypeResolver.Current;

            // --- Assert
            after.ShouldBeOfType(typeof(DefaultTypeResolver));
            _configurationChangedVisited.ShouldBeTrue();
            before.ShouldBeNull();
            _before.ShouldBeNull();
            _after.ShouldEqual(after);
        }
コード例 #3
0
        public void ConfigurationWorksWithConcreteTypeResolver()
        {
            // --- Arrange
            var typeResolver = new TrivialTypeResolver();

            // --- Act
            var before = TypeResolver.Current;

            TypeResolver.Configure(typeResolver);
            var after = TypeResolver.Current;

            // --- Assert
            after.ShouldEqual(typeResolver);
            _configurationChangedVisited.ShouldBeTrue();
            before.ShouldBeNull();
            _before.ShouldBeNull();
            _after.ShouldEqual(after);
        }
コード例 #4
0
        public void ConfigurationWithSettingsResolverToDefaultTypeResolver()
        {
            // --- Arrange
            var settings = new TypeResolverConfigurationSettings(
                (XElement)ConfigurationManager.GetSection(SECTION_NAME));

            // --- Act
            var before = TypeResolver.Current;

            TypeResolver.Configure(settings);
            var after = TypeResolver.Current;

            // --- Assert
            after.ShouldBeOfType(typeof(DefaultTypeResolver));
            _configurationChangedVisited.ShouldBeTrue();
            before.ShouldBeNull();
            _before.ShouldBeNull();
            _after.ShouldEqual(after);
        }