Mocking a method to throw an exception in C#
2015-02-24 06:51
239 查看
http://stackoverflow.com/a/10323930
Mock<IFileConnection> fileConnection = new Mock<IFileConnection>( MockBehavior.Strict); fileConnection.Setup(item => item.Get(It.IsAny<string>,It.IsAny<string>)) .Throws(new IOException());
相关文章推荐
- The method below converts an array of objects to a DataTable object in C#.
- C#中异常:“The type initializer to throw an exception(类型初始值设定项引发异常)”的简单分析与解决方法
- C#中异常:“The type initializer to throw an exception(类型初始值设定项引发异常)”的简单分析与解决方法
- Three ways to throw exception in C#. Which is your preference?
- How to define an array in c#.
- How To Use a DataReader Against an Oracle Stored Procedure in Visual C# .NET
- Different ways how to escape an XML string in C# (zz)
- javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter,
- java 更换皮肤问题Cannot refer to a non-final variable inside an inner class defined in a different method
- Different ways how to escape an XML string in C#
- 直接插入 - An Insecure JSON Data Transference from C# Server Page to Smart Devices Case Share
- Cannot refer to a non-final variable mylis inside an inner class defined in a different method
- An Intro to Constructors in C#
- How do I convert an enum to a list in C#?
- "Cannot refer to a non-final variable * inside an inner class defined in a different method"错误解析
- Cannot refer to a non-final variable music inside an inner class defined in a different method
- All-In-One Code Framework(AIO): 如何使用C#编写进程外的COM组件 (How to write an out-of-proc COM server in C#)
- How to: Add an Action Method to an MVC Controller in Visual Studio
- 【转】How to call c++ exported method and classes in c#
- c#调用c++ dll. unable to find an entry point named function in dll