本文整理汇总了C#中System.TestClass.Method1方法的典型用法代码示例。如果您正苦于以下问题:C# TestClass.Method1方法的具体用法?C# TestClass.Method1怎么用?C# TestClass.Method1使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.TestClass
的用法示例。
在下文中一共展示了TestClass.Method1方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TestDeepProfilingInterceptionBehavior
public void TestDeepProfilingInterceptionBehavior()
{
var profilerId = Guid.NewGuid();
var mockProfiler = new Mock<IProfiler>();
mockProfiler.Setup(p => p.Id).Returns(profilerId);
var mockProfilerProvider = new Mock<IProfilerProvider>();
mockProfilerProvider.Setup(provider => provider.Start(It.IsAny<string>(), It.IsAny<IProfilingStorage>(), It.IsAny<string[]>())).Returns(mockProfiler.Object);
ProfilingSession.ProfilerProvider = mockProfilerProvider.Object;
ProfilingSession.Start("test");
var stepCalled = false;
mockProfiler.Setup(p => p.Step(It.IsAny<string>(), It.IsAny<IEnumerable<string>>(), It.IsAny<string>())).Callback<string, IEnumerable<string>, string>((name, tags, executeType) =>
{
stepCalled = true;
});
var testObj = new TestClass();
var method1 = typeof(TestClass).GetMethod("Method1");
var mockFilter = new Mock<IDeepProfilingFilter>();
mockFilter.Setup(f => f.ShouldBeProfiled(typeof(TestClass))).Returns(true);
var target = new DeepProfilingInterceptionBehavior() as IInterceptionBehavior;
Assert.AreEqual(Type.EmptyTypes, target.GetRequiredInterfaces());
Assert.IsTrue(target.WillExecute);
var mockInput1 = new Mock<IMethodInvocation>();
mockInput1.Setup(i => i.MethodBase).Returns(method1);
mockInput1.Setup(i => i.Target).Returns(testObj);
target.Invoke(mockInput1.Object, () => ((input, next) => { testObj.Method1(); return null; }));
Assert.IsTrue(stepCalled);
Assert.IsTrue(testObj.Method1Invoked);
}