本文整理汇总了C#中ICoordinates.CallsTo方法的典型用法代码示例。如果您正苦于以下问题:C# ICoordinates.CallsTo方法的具体用法?C# ICoordinates.CallsTo怎么用?C# ICoordinates.CallsTo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ICoordinates
的用法示例。
在下文中一共展示了ICoordinates.CallsTo方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GeneratePublishTweetParameter
private IPublishTweetParameters GeneratePublishTweetParameter(
bool canTweetBePublished,
bool hasPlaceIdParameter,
bool hasCoordinatesParameter)
{
var publishTweetParameters = A.Fake<IPublishTweetParameters>();
var text = TestHelper.GenerateString();
_expectedPlaceIdParameter = TestHelper.GenerateString();
_expectedCoordinatesParameter = A.Fake<ICoordinates>();
publishTweetParameters.CallsTo(x => x.Text).Returns(text);
publishTweetParameters.CallsTo(x => x.QuotedTweet).Returns(null);
if (hasPlaceIdParameter)
{
publishTweetParameters.CallsTo(x => x.PlaceId).Returns(_expectedPlaceIdParameter);
}
if (hasCoordinatesParameter)
{
_expectedCoordinatesParameter.CallsTo(x => x.Latitude).Returns(TestHelper.GenerateRandomInt());
_expectedCoordinatesParameter.CallsTo(x => x.Longitude).Returns(TestHelper.GenerateRandomInt());
publishTweetParameters.CallsTo(x => x.Coordinates).Returns(_expectedCoordinatesParameter);
}
else
{
publishTweetParameters.CallsTo(x => x.Coordinates).Returns(null);
}
_expectedTweetParameter = TestHelper.GenerateString();
_fakeTwitterStringFormatter.CallsTo(x => x.TwitterEncode(text)).Returns(_expectedTweetParameter);
_fakeTweetQueryValidator.CallsTo(x => x.ThrowIfTweetCannotBePublished(publishTweetParameters)).Invokes(x =>
{
if (!canTweetBePublished)
{
throw new ArgumentException();
}
});
return publishTweetParameters;
}