summaryrefslogtreecommitdiffstats
path: root/src/DotNetOAuth.Test/Mocks/TestBaseMessage.cs
blob: 8f500cfa609ad287a31a30fed564b3540932b2e4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
//-----------------------------------------------------------------------
// <copyright file="TestBaseMessage.cs" company="Andrew Arnott">
//     Copyright (c) Andrew Arnott. All rights reserved.
// </copyright>
//-----------------------------------------------------------------------

namespace DotNetOAuth.Test.Mocks {
	using System;
	using System.Collections.Generic;
	using System.Runtime.Serialization;
	using DotNetOAuth.Messaging;

	internal interface IBaseMessageExplicitMembers {
		string ExplicitProperty { get; set; }
	}

	[DataContract(Namespace = Protocol.DataContractNamespaceV10)]
	internal class TestBaseMessage : IProtocolMessage, IBaseMessageExplicitMembers {
		private Dictionary<string, string> extraData = new Dictionary<string, string>();

		[DataMember(Name = "age", IsRequired = true)]
		public int Age { get; set; }

		[DataMember]
		public string Name { get; set; }

		[DataMember(Name = "explicit")]
		string IBaseMessageExplicitMembers.ExplicitProperty { get; set; }

		Version IProtocolMessage.ProtocolVersion {
			get { return new Version(1, 0); }
		}

		MessageProtection IProtocolMessage.RequiredProtection {
			get { return MessageProtection.None; }
		}

		MessageTransport IProtocolMessage.Transport {
			get { return MessageTransport.Indirect; }
		}

		IDictionary<string, string> IProtocolMessage.ExtraData {
			get { return this.extraData; }
		}

		internal string PrivatePropertyAccessor {
			get { return this.PrivateProperty; }
			set { this.PrivateProperty = value; }
		}

		[DataMember(Name = "private")]
		private string PrivateProperty { get; set; }

		void IProtocolMessage.EnsureValidMessage() { }
	}
}