当前位置: 首页>>代码示例>>C#>>正文


C# Action.ShouldNotThrow方法代码示例

本文整理汇总了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();
        }
开发者ID:SIXNetworks,项目名称:withSIX.Desktop,代码行数:7,代码来源:RegistryInfoTest.cs

示例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());
        }
开发者ID:cameronfletcher,项目名称:meld,代码行数:11,代码来源:SqlServerDatabase.cs

示例3: AsValidEntityUrl_ValidUrl_DoesNotThrows

		public void AsValidEntityUrl_ValidUrl_DoesNotThrows ()
		{
			// arrange
			var url = "aaa";


			// act
			var action = new Action (() => url.AsValidEntityUrl ("url"));


			// assert
			action.ShouldNotThrow ();
		}
开发者ID:grieg,项目名称:Rocks.Helpers,代码行数:13,代码来源:ValueExtensionsTests.cs

示例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();
            }
        }
开发者ID:codito,项目名称:oshell,代码行数:18,代码来源:UndefinekeyCommandTests.cs

示例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 ();
		}
开发者ID:grieg,项目名称:Rocks.Helpers,代码行数:14,代码来源:ValueExtensionsTests.cs

示例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 ();
		}
开发者ID:grieg,项目名称:Rocks.Helpers,代码行数:13,代码来源:ValueExtensionsTests.cs

示例7: CreatingAResultShouldNotThrowWithValidGuids

 public void CreatingAResultShouldNotThrowWithValidGuids()
 {
     var action = new Action(() => { var result = new Result(Guid.NewGuid(), Guid.NewGuid()); });
     action.ShouldNotThrow();
 }
开发者ID:jorgenlidholm,项目名称:SportsRFIDTimer,代码行数:5,代码来源:ResultTest.cs

示例8: ShouldPass

 protected override void ShouldPass()
 {
     var action = new Action(() => { });
     action.ShouldNotThrow();
 }
开发者ID:JulienFiaffe,项目名称:shouldly,代码行数:5,代码来源:ActionDelegateScenario.cs

示例9: ShouldPass

 public void ShouldPass()
 {
     var action = new Action(() => { });
     action.ShouldNotThrow();
 }
开发者ID:CoderDennis,项目名称:shouldly,代码行数:5,代码来源:ActionDelegateScenario.cs

示例10: ShouldThrowAWobbly

 protected override void ShouldThrowAWobbly()
 {
     var action = new Action(() => { throw new InvalidOperationException(); });
     action.ShouldNotThrow("Some additional context");
 }
开发者ID:gwest,项目名称:shouldly,代码行数:5,代码来源:ActionDelegateScenario.cs


注:本文中的System.Action.ShouldNotThrow方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。