public void WhenScopeEnds_CalledOnCreatedScopedHybridWithTrueSelector_ForwardsCallToTrueLifestyle() { // Arrange CustomScopedLifestyle trueLifestyle = new CustomScopedLifestyle(); CustomScopedLifestyle falseLifestyle = new CustomScopedLifestyle(); ScopedLifestyle hybrid = Lifestyle.CreateHybrid(() => true, trueLifestyle, falseLifestyle); // Act hybrid.WhenScopeEnds(new Container(), () => { }); // Assert Assert.IsTrue(trueLifestyle.ScopeUsed, "TrueLifestyle was expected to be called."); Assert.IsFalse(falseLifestyle.ScopeUsed, "FalseLifestyle was NOT expected to be called."); }
public void WhenScopeEnds_CalledOnCreatedScopedHybridWithFalseSelector_ForwardsCallToFalseLifestyle() { // Arrange CustomScopedLifestyle trueLifestyle = new CustomScopedLifestyle(); CustomScopedLifestyle falseLifestyle = new CustomScopedLifestyle(); ScopedLifestyle hybrid = Lifestyle.CreateHybrid(() => false, trueLifestyle, falseLifestyle); // Act hybrid.WhenScopeEnds(new Container(), () => { }); // Assert Assert.AreEqual(0, trueLifestyle.WhenScopeEndsCallCount, "TrueLifestyle was NOT expected to be called."); Assert.AreEqual(1, falseLifestyle.WhenScopeEndsCallCount, "FalseLifestyle was expected to be called."); }