public void DemoInputValidationException_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 DemoInputValidationException(null); Assert.AreEqual("Exception of type 'Rightpoint.UnitTesting.Demo.Common.Exceptions.DemoInputValidationException' was thrown.", ex.Message); Assert.IsNull(ex.InnerException); }
public void DemoInputValidationException_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 DemoInputValidationException("test"); Assert.AreEqual("test", ex.Message); Assert.IsNull(ex.InnerException); }
public void DemoInputValidationException_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 DemoInputValidationException("test", new Exception("Inner")); byte[] bytes = BinarySerializer.Serialize(inputException); Assert.IsNotNull(bytes); DemoInputValidationException deserializedException = BinarySerializer.Deserialize <DemoInputValidationException>(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); }