protected ThreadStaticContextScope() { // WARN: nested scopes are not supported as it it to erroneous Fail.IfNotNull(ThreadStaticContextScope <T> .Sack, nameof(ThreadStaticContextScope <T>) + " was not cleared properly - are you trying to nest the scope? It is forbidden."); ThreadStaticContextScope <T> .Sack = new SackOf <T>(); }
/// <inheritdoc /> public void Start(Library rootLibrary) { Fail.IfArgumentNull(rootLibrary, nameof(rootLibrary)); Fail.IfNotNull(this.container, Violation.Of($"{nameof(WindsorEngine)} already started")); var librarian = new Librarian(rootLibrary); Library[] allLibraries = librarian.GetLibraries(); var extensions = allLibraries.SelectMany(library => library.GetWindsorEngineExtensions()).ToArray(); this.container = new WindsorContainer(); this.container.Kernel.Resolver.AddSubResolver(new ComponentCollectionResolver(this.container.Kernel)); this.container.Register(Component.For <IWindsorContainer>() .Instance(this.container)); this.container.Register(Component.For <IWindsorEngine>() .Instance(this)); this.container.Register(Component.For <ILibrarian>() .Instance(librarian)); foreach (Library library in allLibraries) { this.RegisterComponentsFrom(library, extensions); } }
public void IfNotNull(object argumentValue) { // ACT var exception = Assert.Throws <DesignByContractViolationException>( () => Fail.IfNotNull(argumentValue, nameof(argumentValue)) ); // ASSERT Assert.That(exception.Message, Is.EqualTo("'argumentValue' is NOT null; and it should be;")); }
public void IfNotNull(object argumentValue) { // ACT var exception = Assert.Throws <DesignByContractViolationException>( () => Fail.IfNotNull(argumentValue, "value is NOT null - something went wrong") ); // ASSERT Assert.That(exception.Message, Is.EqualTo("value is NOT null - something went wrong")); }
public void IfNotNullSuccess([CanBeNull] object argumentValue) { // ACT Fail.IfNotNull(argumentValue, nameof(argumentValue)); }
public void IfNotNullSucces([CanBeNull] object argumentValue) { // ACT Fail.IfNotNull(argumentValue, "value is NOT null - something went wrong"); }