public void Initialize() { _configurationChangedVisited = false; _before = null; _after = null; TypeResolver.Configure((ITypeResolver)null); TypeResolver.ConfigurationChanged += TypeResolverConfigurationChanged; }
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); }
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); }
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); }