public void DemoInvalidOperationException_Constructor_MessageArgument_Null() { // This test verifies that the default constructor works. // Note: this test is useless except for code coverage since we are testing the constructor with no custom logic. var ex = new DemoInvalidOperationException(null); Assert.AreEqual("Exception of type 'Rightpoint.UnitTesting.Demo.Common.Exceptions.DemoInvalidOperationException' was thrown.", ex.Message); Assert.IsNull(ex.InnerException); }
public void DemoInvalidOperationException_Constructor_MessageArgument_Valid() { // This test verifies that the default constructor works. // Note: this test is useless except for code coverage since we are testing the constructor with no custom logic. var ex = new DemoInvalidOperationException("test"); Assert.AreEqual("test", ex.Message); Assert.IsNull(ex.InnerException); }
public void DemoInvalidOperationException_Constructor_Serialization() { // This test verifies that the default constructor works. // Note: this test is useless except for code coverage since we are testing default serialization. DemoException inputException = new DemoInvalidOperationException("test", new Exception("Inner")); byte[] bytes = BinarySerializer.Serialize(inputException); Assert.IsNotNull(bytes); DemoInvalidOperationException deserializedException = BinarySerializer.Deserialize <DemoInvalidOperationException>(bytes); Assert.IsNotNull(deserializedException); Assert.AreEqual(inputException.Message, deserializedException.Message); Assert.IsNotNull(deserializedException.InnerException); Assert.AreEqual(typeof(Exception), deserializedException.InnerException.GetType()); Assert.AreEqual(inputException.InnerException.Message, deserializedException.InnerException.Message); Assert.IsNull(deserializedException.InnerException.InnerException); }