public void InterpretTest() { Thread.CurrentThread.CurrentUICulture = new CultureInfo("en-US"); string temp1 = Resources.ERR001; Assert.AreEqual(Resources.ERR001, ErrorCodeInterpreter.Interpret(1)); Assert.AreEqual(Resources.ERR600, ErrorCodeInterpreter.Interpret(600)); Assert.AreEqual(Resources.ERR610, ErrorCodeInterpreter.Interpret(610)); Assert.AreEqual(Resources.ERR615, ErrorCodeInterpreter.Interpret(615)); Assert.AreEqual(Resources.ERR620, ErrorCodeInterpreter.Interpret(620)); }
/// <summary> /// 覆盖ToString为类似"(ERR001) 错误详细信息"这种格式 /// </summary> /// <returns></returns> public override string ToString() { return(string.Format("(ERR{0}) {1}", ErrorCode.ToString("d3"), ErrorCodeInterpreter.Interpret(ErrorCode))); }