本文整理汇总了C#中Mock.Method1方法的典型用法代码示例。如果您正苦于以下问题:C# Mock.Method1方法的具体用法?C# Mock.Method1怎么用?C# Mock.Method1使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mock
的用法示例。
在下文中一共展示了Mock.Method1方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TestMockMethodCalled
public void TestMockMethodCalled()
{
dynamic mock = new Mock();
mock.Setup("Method1", new object[] { "a", It.IsAny<int>() }, 10);
Assert.AreEqual(10, mock.Method1("a", -2));
Assert.AreEqual(10, mock.Method1("b", -2m));
mock.Verify();
}
示例2: TestMockParameterNotNull
public void TestMockParameterNotNull()
{
dynamic mock = new Mock();
mock.Setup("Method1", new object[] { "a", It.IsNotNull() }, 10);
Assert.AreEqual(10, mock.Method1("a", null));
mock.Verify();
}
示例3: TestMockParameterCount
public void TestMockParameterCount()
{
dynamic mock = new Mock();
mock.Setup("Method1", new object[] { "a", 2.5m }, 10);
Assert.AreEqual(10, mock.Method1());
mock.Verify();
}
示例4: TestMock
public void TestMock()
{
dynamic mock = new Mock();
mock.SetupGet("Prop1", 1);
mock.SetupSet("Prop1", 5);
mock.Setup("Method1", new object[] { "a", -2 }, 10);
Assert.AreEqual(1, mock.Prop1);
mock.Prop1 = 5;
Assert.AreEqual(10, mock.Method1("a", -2));
mock.Verify();
}