public void Construct_Message_InnerException() { var innerException = new Exception(); var exception = new TraitSpecException("Message", innerException); Assert.That(exception.Message, Is.EqualTo("Message")); Assert.That(exception.InnerException, Is.SameAs(innerException)); }
public void Serialization_RoundTrip() { var exception = new TraitSpecException("MessageA", new Exception("MessageB")); var formatter = new BinaryFormatter(); using (var stream = new MemoryStream(512)) { formatter.Serialize(stream, exception); stream.Position = 0; exception = (TraitSpecException) formatter.Deserialize(stream); } Assert.That(exception, Is.Not.Null); Assert.That(exception.Message, Is.EqualTo("MessageA")); Assert.That(exception.InnerException, Is.Not.Null); Assert.That(exception.InnerException.Message, Is.EqualTo("MessageB")); }
public void Construct_Message() { var exception = new TraitSpecException("Message"); Assert.That(exception.Message, Is.EqualTo("Message")); }
public void Construct_Default() { var exception = new TraitSpecException(); }