public void TestDeepProfilingInterceptionStrategy() { var mockFilter = new Mock<IDeepProfilingFilter>(); mockFilter.Setup(f => f.ShouldBeProfiled(typeof(ITestClass))).Returns(true); var target = new DeepProfilingInterceptionStrategy(mockFilter.Object); var mockContext = new Mock<IBuilderContext>(); var testObj = new TestClass(); mockContext.Setup(c => c.Existing).Returns(testObj); mockContext.Setup(c => c.OriginalBuildKey).Returns(new NamedTypeBuildKey(typeof(ITestClass))); var proxyCreated = false; mockContext.SetupSet(c => c.Existing = It.IsAny<object>()).Callback<object>(value => { proxyCreated = true; }); target.PostBuildUp(mockContext.Object); Assert.IsTrue(proxyCreated); }
public void TestDeepProfilingInterceptionStrategyWithEmptyContext() { var mockFilter = new Mock<IDeepProfilingFilter>(); var target = new DeepProfilingInterceptionStrategy(mockFilter.Object); target.PostBuildUp(null); }