diff options
author | Andrew Arnott <andrewarnott@gmail.com> | 2009-01-09 21:03:29 -0800 |
---|---|---|
committer | Andrew <andrewarnott@gmail.com> | 2009-01-09 21:03:29 -0800 |
commit | d8abcbe507383d3510ee45ed19f6503c60d7d63b (patch) | |
tree | 64d656b165aed099ef68881c98082d552f5af2e4 /src/DotNetOpenAuth.Test/Messaging/ProtocolExceptionTests.cs | |
parent | 588d1384431e23827921124bd438569231cbdfa7 (diff) | |
download | DotNetOpenAuth-d8abcbe507383d3510ee45ed19f6503c60d7d63b.zip DotNetOpenAuth-d8abcbe507383d3510ee45ed19f6503c60d7d63b.tar.gz DotNetOpenAuth-d8abcbe507383d3510ee45ed19f6503c60d7d63b.tar.bz2 |
CRLF -> LF line endings change to all .cs files.
Diffstat (limited to 'src/DotNetOpenAuth.Test/Messaging/ProtocolExceptionTests.cs')
-rw-r--r-- | src/DotNetOpenAuth.Test/Messaging/ProtocolExceptionTests.cs | 194 |
1 files changed, 97 insertions, 97 deletions
diff --git a/src/DotNetOpenAuth.Test/Messaging/ProtocolExceptionTests.cs b/src/DotNetOpenAuth.Test/Messaging/ProtocolExceptionTests.cs index f245702..21f2928 100644 --- a/src/DotNetOpenAuth.Test/Messaging/ProtocolExceptionTests.cs +++ b/src/DotNetOpenAuth.Test/Messaging/ProtocolExceptionTests.cs @@ -1,97 +1,97 @@ -//-----------------------------------------------------------------------
-// <copyright file="ProtocolExceptionTests.cs" company="Andrew Arnott">
-// Copyright (c) Andrew Arnott. All rights reserved.
-// </copyright>
-//-----------------------------------------------------------------------
-
-namespace DotNetOpenAuth.Test.Messaging {
- using System;
- using DotNetOpenAuth.Messaging;
- using Microsoft.VisualStudio.TestTools.UnitTesting;
-
- [TestClass]
- public class ProtocolExceptionTests : TestBase {
- [TestMethod]
- public void CtorDefault() {
- ProtocolException ex = new ProtocolException();
- }
-
- [TestMethod]
- public void CtorWithTextMessage() {
- ProtocolException ex = new ProtocolException("message");
- Assert.AreEqual("message", ex.Message);
- }
-
- [TestMethod]
- public void CtorWithTextMessageAndInnerException() {
- Exception innerException = new Exception();
- ProtocolException ex = new ProtocolException("message", innerException);
- Assert.AreEqual("message", ex.Message);
- Assert.AreSame(innerException, ex.InnerException);
- }
-
- [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();
- }
-
- [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();
- }
- }
-}
+//----------------------------------------------------------------------- +// <copyright file="ProtocolExceptionTests.cs" company="Andrew Arnott"> +// Copyright (c) Andrew Arnott. All rights reserved. +// </copyright> +//----------------------------------------------------------------------- + +namespace DotNetOpenAuth.Test.Messaging { + using System; + using DotNetOpenAuth.Messaging; + using Microsoft.VisualStudio.TestTools.UnitTesting; + + [TestClass] + public class ProtocolExceptionTests : TestBase { + [TestMethod] + public void CtorDefault() { + ProtocolException ex = new ProtocolException(); + } + + [TestMethod] + public void CtorWithTextMessage() { + ProtocolException ex = new ProtocolException("message"); + Assert.AreEqual("message", ex.Message); + } + + [TestMethod] + public void CtorWithTextMessageAndInnerException() { + Exception innerException = new Exception(); + ProtocolException ex = new ProtocolException("message", innerException); + Assert.AreEqual("message", ex.Message); + Assert.AreSame(innerException, ex.InnerException); + } + + [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(); + } + + [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(); + } + } +} |