public void IrbisException_Constructor_3() { const string expected = "internal error"; IrbisException exception = new IrbisException(expected); Assert.AreEqual(0, exception.ErrorCode); Assert.AreEqual(expected, exception.Message); }
public void IrbisException_Constructor_4() { const string expected = "internal error"; Exception innerException = new Exception(); IrbisException exception = new IrbisException(expected, innerException); Assert.AreEqual(0, exception.ErrorCode); Assert.AreEqual(expected, exception.Message); Assert.AreSame(innerException, exception.InnerException); }
public string GetUtfString() { using (MemoryStream memory = Connection.Executive .GetMemoryStream(GetType())) { _savedPosition = _stream.Position; while (true) { int code = _stream.ReadByte(); if (code < 0) { return(null); } if (code == 0x0D) { code = _stream.ReadByte(); if (code == 0x0A) { break; } memory.WriteByte(0x0D); } memory.WriteByte((byte)code); } string result; byte[] buffer = memory.ToArray(); Connection.Executive.ReportMemoryUsage ( GetType(), buffer.Length ); try { result = IrbisEncoding.Utf8.GetString ( buffer, 0, buffer.Length ); } catch (Exception inner) { Log.TraceException ( "ServerResponse::GetUtfString", inner ); IrbisException outer = new IrbisException ( "ServerResponse::GetUtfString failed", inner ); BinaryAttachment attachment = new BinaryAttachment ( "problem line", GetDump() ); outer.Attach(attachment); throw outer; } return(result); } }
public void IrbisException_GetErrorDescription_3() { Assert.AreEqual("Нет ошибки", IrbisException.GetErrorDescription(new IrbisException(100))); Assert.AreEqual("Указанное поле отсутствует", IrbisException.GetErrorDescription(new IrbisException(-200))); }
public void IrbisException_GetErrorDescription_2() { Assert.AreEqual("Нормальное завершение", IrbisException.GetErrorDescription(IrbisReturnCode.NoError)); Assert.AreEqual("Файл не существует", IrbisException.GetErrorDescription(IrbisReturnCode.FileNotExist)); }
public void IrbisException_GetErrorDescription_1() { Assert.AreEqual("Нет ошибки", IrbisException.GetErrorDescription(100)); Assert.AreEqual("Нормальное завершение", IrbisException.GetErrorDescription(0)); Assert.AreEqual("Указанное поле отсутствует", IrbisException.GetErrorDescription(-200)); }
public void IrbisException_Constructor_2() { IrbisException exception = new IrbisException(-2222); Assert.AreEqual(-2222, exception.ErrorCode); }
public void IrbisException_Constructor_1() { IrbisException exception = new IrbisException(); Assert.AreEqual(0, exception.ErrorCode); }