⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mockcall.cs

📁 C#编写的网络爬虫程序 效率很高 很好用!
💻 CS
字号:
using System;
using NUnit.Framework;

namespace NUnit.Mocks
{
	/// <summary>
	/// Summary description for ExpectedCall.
	/// </summary>
	public class MockCall : ICall
	{
		private MethodSignature signature;
		private object returnVal;
		private Exception exception;
		private object[] expectedArgs;

//		public static object[] Any = new object[0];

		public MockCall( MethodSignature signature, object  returnVal, Exception exception, params object[] args )
		{
			this.signature = signature;
			this.returnVal = returnVal;
			this.exception = exception;
			this.expectedArgs = args;
		}

		public object Call( object[] actualArgs )
		{
			if ( expectedArgs != null )
//			if ( expectedArgs.Length != 0 )
			{
				//Assert.IsTrue( signature.IsCompatibleWith( actualArgs ) );
				Assert.AreEqual( expectedArgs.Length, actualArgs.Length );

				for( int i = 0; i < expectedArgs.Length; i++ )
					Assert.AreEqual( expectedArgs[i], actualArgs[i] );
			}
			
			if ( exception != null )
				throw exception;

			return returnVal;
		}
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -