public void SealingAMappingMakesItUnchangable() { InjectionMapping config = new InjectionMapping(injector, new MappingId(typeof(Interface), null)); config.Seal(); List <MethodInfo> testMethods = new List <MethodInfo> (); List <object[]> testMethodArguments = new List <object[]> (); testMethods.Add(config.GetType().GetMethod("AsSingleton")); testMethodArguments.Add(new object[1] { false }); testMethods.Add(config.GetType().GetMethod("ToSingleton", new Type[] { typeof(Type), typeof(bool) })); testMethodArguments.Add(new object[2] { typeof(Clazz), false }); testMethods.Add(config.GetType().GetMethod("ToType", new Type[] { typeof(Type) })); testMethodArguments.Add(new object[1] { typeof(Clazz) }); testMethods.Add(config.GetType().GetMethod("ToValue")); testMethodArguments.Add(new object[3] { typeof(Clazz), false, false }); testMethods.Add(config.GetType().GetMethod("ToProvider")); testMethodArguments.Add(new object[1] { null }); testMethods.Add(config.GetType().GetMethod("Locally")); testMethodArguments.Add(null); testMethods.Add(config.GetType().GetMethod("Softly")); testMethodArguments.Add(null); List <MethodInfo> injectionExeptionMethods = new List <MethodInfo> (); for (int i = 0; i < testMethods.Count; i++) { MethodInfo methodInfo = testMethods [i]; try { methodInfo.Invoke(config, testMethodArguments [i]); } catch (Exception exception) { if (exception.InnerException != null && exception.InnerException is InjectorException) { injectionExeptionMethods.Add(methodInfo); } else { throw exception; } } } Assert.AreEqual(testMethods.Count, injectionExeptionMethods.Count); for (int i = 0; i < testMethods.Count; i++) { Assert.AreEqual(testMethods [i], injectionExeptionMethods [i]); } }