public void CanCreateExceptionWithInnerException() { var inner = new AcmeException(); var ex = new AcmeRequestException("certes", inner); Assert.Equal("certes", ex.Message); Assert.Equal(inner, ex.InnerException); }
public void CanSerialize() { var ex = new AcmeRequestException("certes"); var serializer = new BinaryFormatter(); using (var buffer = new MemoryStream()) { serializer.Serialize(buffer, ex); buffer.Seek(0, SeekOrigin.Begin); var deserialized = (AcmeRequestException)serializer.Deserialize(buffer); Assert.Equal("certes", deserialized.Message); } }
public void CanSerializeWithError() { var error = new AcmeError { Detail = "error" }; var ex = new AcmeRequestException("certes", error); var serializer = new BinaryFormatter(); using (var buffer = new MemoryStream()) { serializer.Serialize(buffer, ex); buffer.Seek(0, SeekOrigin.Begin); var deserialized = (AcmeRequestException)serializer.Deserialize(buffer); Assert.NotNull(deserialized.Error.Detail); Assert.Equal("error", deserialized.Error.Detail); } }
public void CanCreateExceptionWithMessage() { var ex = new AcmeRequestException("certes"); Assert.Equal("certes", ex.Message); }
public void CanCreateException() { var ex = new AcmeRequestException(); }