本文整理汇总了C#中System.Action.ShouldNotThrow方法的典型用法代码示例。如果您正苦于以下问题:C# Action.ShouldNotThrow方法的具体用法?C# Action.ShouldNotThrow怎么用?C# Action.ShouldNotThrow使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Action
的用法示例。
在下文中一共展示了Action.ShouldNotThrow方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CannotCreateWithInvalidFolder
public void CannotCreateWithInvalidFolder() {
var act = new Action(() => new RegistryInfo("some path", null));
var act2 = new Action(() => new RegistryInfo("some path", ""));
act.ShouldThrow<ArgumentNullException>();
act2.ShouldNotThrow();
}
示例2: CanAlterDatabase
public void CanAlterDatabase(SqlConnection connection, Action action)
{
"Given a SQL Server connection"
.f(c => connection = new SqlConnection(this.ConnectionString).Using(c));
"When I initialize that connection for this test"
.f(() => action = () => connection.InitializeSchema("features", "CanAlterDatabase"));
"Then that action should succeed"
.f(() => action.ShouldNotThrow());
}
示例3: AsValidEntityUrl_ValidUrl_DoesNotThrows
public void AsValidEntityUrl_ValidUrl_DoesNotThrows ()
{
// arrange
var url = "aaa";
// act
var action = new Action (() => url.AsValidEntityUrl ("url"));
// assert
action.ShouldNotThrow ();
}
示例4: UndefinekeyCommandHandlerExecuteUnregistersAKeySequence
public async Task UndefinekeyCommandHandlerExecuteUnregistersAKeySequence()
{
var keySequences = new[] { "A", "Control+T", "Control+Shift+Alt+T" };
var undefinekeyCommandHandler = new UndefinekeyCommandHandler(this.keyMapService);
var keymap = this.keyMapService.GetKeyMapByName(TestKeyMap);
foreach (var keySequence in keySequences)
{
var undefinekeyCommand = new UndefinekeyCommand { Args = TestKeyMap + " " + keySequence };
(await undefinekeyCommandHandler.Execute(undefinekeyCommand)).Should().BeTrue();
var registerKey = new Action(
() =>
{
keymap.RegisterAction((Keys)new KeysConverter().ConvertFrom(keySequence), args => Task.Run(() => true));
});
registerKey.ShouldNotThrow();
}
}
示例5: AsValidEntityUrl_Null_DoesNotThrows
public void AsValidEntityUrl_Null_DoesNotThrows ()
{
// arrange
string url = null;
// act
// ReSharper disable once ExpressionIsAlwaysNull
var action = new Action (() => url.AsValidEntityUrl ("url"));
// assert
action.ShouldNotThrow ();
}
示例6: AsValidEmail_ValidEmail_DoesNotThrows
public void AsValidEmail_ValidEmail_DoesNotThrows ()
{
// arrange
var email = "[email protected]";
// act
var action = new Action (() => email.AsValidEmail ("email"));
// assert
action.ShouldNotThrow ();
}
示例7: CreatingAResultShouldNotThrowWithValidGuids
public void CreatingAResultShouldNotThrowWithValidGuids()
{
var action = new Action(() => { var result = new Result(Guid.NewGuid(), Guid.NewGuid()); });
action.ShouldNotThrow();
}
示例8: ShouldPass
protected override void ShouldPass()
{
var action = new Action(() => { });
action.ShouldNotThrow();
}
示例9: ShouldPass
public void ShouldPass()
{
var action = new Action(() => { });
action.ShouldNotThrow();
}
示例10: ShouldThrowAWobbly
protected override void ShouldThrowAWobbly()
{
var action = new Action(() => { throw new InvalidOperationException(); });
action.ShouldNotThrow("Some additional context");
}