本文整理汇总了C#中Operations.GetAction方法的典型用法代码示例。如果您正苦于以下问题:C# Operations.GetAction方法的具体用法?C# Operations.GetAction怎么用?C# Operations.GetAction使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Operations
的用法示例。
在下文中一共展示了Operations.GetAction方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Action_With_14_Args_InvokeWithNoRetry
public void Action_With_14_Args_InvokeWithNoRetry()
{
// arrange
Operations operations = new Operations(0);
var action = operations.GetAction<int,int,int,int,int,int,int,int,int,int,int,int,int,int>();
// act
action.InvokeWithRetry(RetryPolicies.NoRetry(),0,0,0,0,0,0,0,0,0,0,0,0,0,0);
// assert
Assert.Equal(0, operations.ThrowCount);
Assert.Equal(1, operations.ExecuteCount);
}
示例2: Action_With_No_Args_InvokeWithNoRetry
public void Action_With_No_Args_InvokeWithNoRetry()
{
// arrange
Operations operations = new Operations(0);
var policy = Policy.NoRetry();
var action = operations.GetAction();
// act
action.InvokeWithRetry(policy.RetryPolicy);
// assert
Assert.Equal(0, policy.ShouldRetryCallCount);
Assert.Equal(0, operations.ThrowCount);
Assert.Equal(1, operations.ExecuteCount);
}
示例3: Action_will_throw_when_policy_returns_false
public void Action_will_throw_when_policy_returns_false()
{
// arrange
Operations operations = new Operations(1);
var policy = Policy.NoRetry();
var action = operations.GetAction();
Assert.ThrowsDelegate testCode = () => action.InvokeWithRetry(policy.RetryPolicy);
// act
Exception exception = Assert.Throws<Exception>(testCode);
// assert
Assert.Equal(string.Format(Operations.ExceptionMessageFormat, 1), exception.Message);
Assert.Equal(1, operations.ThrowCount);
Assert.Equal(1, operations.ExecuteCount);
}