diff options
Diffstat (limited to 'src/DotNetOpenAuth.Test/Mocks/TestMessage.cs')
-rw-r--r-- | src/DotNetOpenAuth.Test/Mocks/TestMessage.cs | 164 |
1 files changed, 82 insertions, 82 deletions
diff --git a/src/DotNetOpenAuth.Test/Mocks/TestMessage.cs b/src/DotNetOpenAuth.Test/Mocks/TestMessage.cs index 4a168a1..a2f5328 100644 --- a/src/DotNetOpenAuth.Test/Mocks/TestMessage.cs +++ b/src/DotNetOpenAuth.Test/Mocks/TestMessage.cs @@ -1,82 +1,82 @@ -//----------------------------------------------------------------------- -// <copyright file="TestMessage.cs" company="Andrew Arnott"> -// Copyright (c) Andrew Arnott. All rights reserved. -// </copyright> -//----------------------------------------------------------------------- - -namespace DotNetOpenAuth.Test.Mocks { - using System; - using System.Collections.Generic; - using System.Runtime.Serialization; - using DotNetOpenAuth.Messaging; - using DotNetOpenAuth.Messaging.Reflection; - - internal abstract class TestMessage : IDirectResponseProtocolMessage { - private MessageTransport transport; - private Dictionary<string, string> extraData = new Dictionary<string, string>(); - private bool incoming; - - protected TestMessage() - : this(MessageTransport.Direct) { - } - - protected TestMessage(MessageTransport transport) { - this.transport = transport; - } - - [MessagePart("age", IsRequired = true)] - public int Age { get; set; } - [MessagePart("Name")] - public string Name { get; set; } - [MessagePart] - public string EmptyMember { get; set; } - [MessagePart(null)] // null name tests that Location is still the name. - public Uri Location { get; set; } - [MessagePart(IsRequired = true)] - public DateTime Timestamp { get; set; } - - #region IProtocolMessage Properties - - Version IProtocolMessage.ProtocolVersion { - get { return new Version(1, 0); } - } - - MessageProtections IProtocolMessage.RequiredProtection { - get { return MessageProtections.None; } - } - - MessageTransport IProtocolMessage.Transport { - get { return this.transport; } - } - - IDictionary<string, string> IProtocolMessage.ExtraData { - get { return this.extraData; } - } - - bool IProtocolMessage.Incoming { - get { return this.incoming; } - } - - #endregion - - #region IDirectResponseProtocolMessage Members - - public IDirectedProtocolMessage OriginatingRequest { get; set; } - - #endregion - - #region IProtocolMessage Methods - - void IProtocolMessage.EnsureValidMessage() { - if (this.EmptyMember != null || this.Age < 0) { - throw new ProtocolException(); - } - } - - #endregion - - internal void SetAsIncoming() { - this.incoming = true; - } - } -} +//-----------------------------------------------------------------------
+// <copyright file="TestMessage.cs" company="Andrew Arnott">
+// Copyright (c) Andrew Arnott. All rights reserved.
+// </copyright>
+//-----------------------------------------------------------------------
+
+namespace DotNetOpenAuth.Test.Mocks {
+ using System;
+ using System.Collections.Generic;
+ using System.Runtime.Serialization;
+ using DotNetOpenAuth.Messaging;
+ using DotNetOpenAuth.Messaging.Reflection;
+
+ internal abstract class TestMessage : IDirectResponseProtocolMessage {
+ private MessageTransport transport;
+ private Dictionary<string, string> extraData = new Dictionary<string, string>();
+ private bool incoming;
+
+ protected TestMessage()
+ : this(MessageTransport.Direct) {
+ }
+
+ protected TestMessage(MessageTransport transport) {
+ this.transport = transport;
+ }
+
+ [MessagePart("age", IsRequired = true)]
+ public int Age { get; set; }
+ [MessagePart("Name")]
+ public string Name { get; set; }
+ [MessagePart]
+ public string EmptyMember { get; set; }
+ [MessagePart(null)] // null name tests that Location is still the name.
+ public Uri Location { get; set; }
+ [MessagePart(IsRequired = true)]
+ public DateTime Timestamp { get; set; }
+
+ #region IProtocolMessage Properties
+
+ Version IMessage.Version {
+ get { return new Version(1, 0); }
+ }
+
+ MessageProtections IProtocolMessage.RequiredProtection {
+ get { return MessageProtections.None; }
+ }
+
+ MessageTransport IProtocolMessage.Transport {
+ get { return this.transport; }
+ }
+
+ IDictionary<string, string> IMessage.ExtraData {
+ get { return this.extraData; }
+ }
+
+ bool IMessage.Incoming {
+ get { return this.incoming; }
+ }
+
+ #endregion
+
+ #region IDirectResponseProtocolMessage Members
+
+ public IDirectedProtocolMessage OriginatingRequest { get; set; }
+
+ #endregion
+
+ #region IMessage Methods
+
+ void IMessage.EnsureValidMessage() {
+ if (this.EmptyMember != null || this.Age < 0) {
+ throw new ProtocolException();
+ }
+ }
+
+ #endregion
+
+ internal void SetAsIncoming() {
+ this.incoming = true;
+ }
+ }
+}
|