// // // // // $Revision$ // using System; using System.Collections.Generic; using ICSharpCode.PythonBinding; namespace PythonBinding.Tests.Console { public class MockMemberProvider : IMemberProvider { List memberNames = new List(); string getMemberNamesParameter; List globals = new List(); string getGlobalsParameter; Exception exceptionToThrow; public MockMemberProvider() { } /// /// Exception that will be thrown if the GetMemberNames method or GetGlobals method is called. /// public Exception ExceptionToThrow { get { return exceptionToThrow; } set { exceptionToThrow = value; } } public void SetMemberNames(string[] names) { memberNames.AddRange(names); } public IList GetMemberNames(string name) { getMemberNamesParameter = name; if (exceptionToThrow != null) { throw exceptionToThrow; } return memberNames; } public void SetGlobals(string[] names) { globals.AddRange(names); } public IList GetGlobals(string name) { getGlobalsParameter = name; if (exceptionToThrow != null) { throw exceptionToThrow; } return globals; } /// /// Returns the parameter passed to the GetGlobals method. /// public string GetGlobalsParameter { get { return getGlobalsParameter; } } /// /// Returns the parameter passed to the GetMemberNames method. /// public string GetMemberNamesParameter { get { return getMemberNamesParameter; } } } }