本文整理汇总了C#中BaseClass.ReturnSomething方法的典型用法代码示例。如果您正苦于以下问题:C# BaseClass.ReturnSomething方法的具体用法?C# BaseClass.ReturnSomething怎么用?C# BaseClass.ReturnSomething使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BaseClass
的用法示例。
在下文中一共展示了BaseClass.ReturnSomething方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CallBaseMethod
public static void CallBaseMethod(
BaseClass fake,
int returnValue,
bool callbackWasInvoked)
{
"Given a fake"
.x(() => fake = A.Fake<BaseClass>());
"And I configure a method to invoke an action and call the base method"
.x(() =>
A.CallTo(() => fake.ReturnSomething())
.Invokes(x => callbackWasInvoked = true)
.CallsBaseMethod());
"When I call the method"
.x(() => returnValue = fake.ReturnSomething());
"Then it calls the base method"
.x(() => fake.WasCalled.Should().BeTrue());
"And it returns the value from base method"
.x(() => returnValue.Should().Be(10));
"And it invokes the callback"
.x(() => callbackWasInvoked.Should().BeTrue());
}
示例2: CallBaseMethod
public static void CallBaseMethod(
BaseClass fake,
int returnValue,
bool callbackWasInvoked)
{
"establish"
.x(() => fake = A.Fake<BaseClass>());
"when configuring to call base method"
.x(() =>
{
A.CallTo(() => fake.ReturnSomething()).Invokes(x => callbackWasInvoked = true).CallsBaseMethod();
returnValue = fake.ReturnSomething();
});
"it should have called the base method"
.x(() => fake.WasCalled.Should().BeTrue());
"it should return value from base method"
.x(() => returnValue.Should().Be(10));
"it should invoke the callback"
.x(() => callbackWasInvoked.Should().BeTrue());
}