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 ConfigurationChangeIsCaught() { // --- Arrange var settings = new TypeResolverConfigurationSettings( (XElement)ConfigurationManager.GetSection(SECTION_NAME)); var typeResolver = new TrivialTypeResolver(); // --- Act TypeResolver.Configure(settings); var before = TypeResolver.Current; TypeResolver.Configure(typeResolver); var after = TypeResolver.Current; // --- Assert before.ShouldBeOfType(typeof(DefaultTypeResolver)); _before.ShouldEqual(before); _configurationChangedVisited.ShouldBeTrue(); after.ShouldEqual(typeResolver); _after.ShouldEqual(after); }