diff options
Diffstat (limited to 'src/DotNetOpenAuth.Test/Messaging/ProtocolExceptionTests.cs')
-rw-r--r-- | src/DotNetOpenAuth.Test/Messaging/ProtocolExceptionTests.cs | 60 |
1 files changed, 4 insertions, 56 deletions
diff --git a/src/DotNetOpenAuth.Test/Messaging/ProtocolExceptionTests.cs b/src/DotNetOpenAuth.Test/Messaging/ProtocolExceptionTests.cs index 21f2928..430b929 100644 --- a/src/DotNetOpenAuth.Test/Messaging/ProtocolExceptionTests.cs +++ b/src/DotNetOpenAuth.Test/Messaging/ProtocolExceptionTests.cs @@ -32,66 +32,14 @@ namespace DotNetOpenAuth.Test.Messaging { [TestMethod] public void CtorWithProtocolMessage() { - IProtocolMessage request = new Mocks.TestDirectedMessage(); - Uri receiver = new Uri("http://receiver"); - ProtocolException ex = new ProtocolException("some error occurred", request, receiver); - IDirectedProtocolMessage msg = (IDirectedProtocolMessage)ex; - Assert.AreEqual("some error occurred", ex.Message); - Assert.AreSame(receiver, msg.Recipient); - Assert.AreEqual(request.Version, msg.Version); - Assert.AreEqual(request.Transport, msg.Transport); - msg.EnsureValidMessage(); + IProtocolMessage message = new Mocks.TestDirectedMessage(); + ProtocolException ex = new ProtocolException("message", message); + Assert.AreSame(message, ex.FaultedMessage); } [TestMethod, ExpectedException(typeof(ArgumentNullException))] public void CtorWithNullProtocolMessage() { - new ProtocolException("message", null, new Uri("http://receiver")); - } - - [TestMethod, ExpectedException(typeof(ArgumentNullException))] - public void CtorWithNullReceiver() { - new ProtocolException("message", new Mocks.TestDirectedMessage(MessageTransport.Indirect), null); - } - - /// <summary> - /// Tests that exceptions being sent as direct responses do not need an explicit receiver. - /// </summary> - [TestMethod] - public void CtorUndirectedMessageWithNullReceiver() { - IProtocolMessage request = new Mocks.TestDirectedMessage(MessageTransport.Direct); - ProtocolException ex = new ProtocolException("message", request, null); - IDirectedProtocolMessage msg = (IDirectedProtocolMessage)ex; - Assert.IsNull(msg.Recipient); - Assert.AreEqual(request.Version, msg.Version); - Assert.AreEqual(request.Transport, msg.Transport); - } - - [TestMethod, ExpectedException(typeof(InvalidOperationException))] - public void ProtocolVersionWithoutMessage() { - ProtocolException ex = new ProtocolException(); - IDirectedProtocolMessage msg = (IDirectedProtocolMessage)ex; - var temp = msg.Version; - } - - [TestMethod, ExpectedException(typeof(InvalidOperationException))] - public void TransportWithoutMessage() { - ProtocolException ex = new ProtocolException(); - IDirectedProtocolMessage msg = (IDirectedProtocolMessage)ex; - var temp = msg.Transport; - } - - [TestMethod, ExpectedException(typeof(InvalidOperationException))] - public void RecipientWithoutMessage() { - ProtocolException ex = new ProtocolException(); - IDirectedProtocolMessage msg = (IDirectedProtocolMessage)ex; - var temp = msg.Recipient; - } - - [TestMethod, ExpectedException(typeof(InvalidOperationException))] - public void EnsureValidMessageWithoutMessage() { - ProtocolException ex = new ProtocolException(); - IDirectedProtocolMessage msg = (IDirectedProtocolMessage)ex; - msg.EnsureValidMessage(); + new ProtocolException("message", (IProtocolMessage)null); } } } |