public void TestInnerException() { Exception inner = new Exception("This is a test"); ProtocolLevelAlreadySetException testException = new ProtocolLevelAlreadySetException("Hello World", inner); Assert.AreSame(inner, testException.InnerException); }
public void TestDefaultConstructor() { ProtocolLevelAlreadySetException testException = new ProtocolLevelAlreadySetException(); string testExceptionString = testException.ToString(); Assert.IsNotNull(testExceptionString); }
public void TestInnerException() { Exception inner = new Exception("This is a test"); ProtocolLevelAlreadySetException testException = new ProtocolLevelAlreadySetException("Hello World", inner); Assert.AreSame(inner, testException.InnerException); }
public void TestDefaultConstructor() { ProtocolLevelAlreadySetException testException = new ProtocolLevelAlreadySetException(); string testExceptionString = testException.ToString(); Assert.IsNotNull(testExceptionString); }
public void TestSerialization() { BinaryFormatter formatter = new BinaryFormatter(); using(MemoryStream memory = new MemoryStream()) { ProtocolLevelAlreadySetException exception1 = new ProtocolLevelAlreadySetException("Hello World"); formatter.Serialize(memory, exception1); memory.Position = 0; object exception2 = formatter.Deserialize(memory); Assert.IsInstanceOf<ProtocolLevelAlreadySetException>(exception2); Assert.AreEqual( exception1.Message, ((ProtocolLevelAlreadySetException)exception2).Message ); } }
public void TestSerialization() { BinaryFormatter formatter = new BinaryFormatter(); using (MemoryStream memory = new MemoryStream()) { ProtocolLevelAlreadySetException exception1 = new ProtocolLevelAlreadySetException("Hello World"); formatter.Serialize(memory, exception1); memory.Position = 0; object exception2 = formatter.Deserialize(memory); Assert.IsInstanceOf <ProtocolLevelAlreadySetException>(exception2); Assert.AreEqual( exception1.Message, ((ProtocolLevelAlreadySetException)exception2).Message ); } }