blob: 30a290de25432325a3c8792f31d9fb3f56162ae9 (
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
57
58
59
60
61
|
//-----------------------------------------------------------------------
// <copyright file="TestDirectedMessage.cs" company="Andrew Arnott">
// Copyright (c) Andrew Arnott. All rights reserved.
// </copyright>
//-----------------------------------------------------------------------
namespace DotNetOAuth.Test.Mocks {
using System;
using System.Runtime.Serialization;
using DotNetOAuth.Messaging;
[DataContract(Namespace = Protocol.DataContractNamespaceV10)]
internal class TestDirectedMessage : IDirectedProtocolMessage {
private MessageTransport transport;
internal TestDirectedMessage(MessageTransport transport) {
this.transport = transport;
}
[DataMember(Name = "age", IsRequired = true)]
public int Age { get; set; }
[DataMember]
public string Name { get; set; }
[DataMember]
public string EmptyMember { get; set; }
[DataMember]
public Uri Location { get; set; }
#region IDirectedProtocolMessage Members
public Uri Recipient { get; internal set; }
#endregion
#region IProtocolMessage Members
Version IProtocolMessage.ProtocolVersion {
get { return new Version(1, 0); }
}
MessageProtection IProtocolMessage.RequiredProtection {
get { return this.RequiredProtection; }
}
MessageTransport IProtocolMessage.Transport {
get { return this.transport; }
}
void IProtocolMessage.EnsureValidMessage() {
if (this.EmptyMember != null || this.Age < 0) {
throw new ProtocolException();
}
}
#endregion
protected virtual MessageProtection RequiredProtection {
get { return MessageProtection.None; }
}
}
}
|