Line data Source code
1 : using System;
2 : using System.Collections.Generic;
3 : using System.Runtime.Serialization;
4 : using Cqrs.Events;
5 : using Cqrs.Authentication;
6 : using Cqrs.Messages;
7 :
8 : namespace Cqrs.Tests.Substitutes
9 : {
10 : public class TestAggregateDidSomething : IEvent<ISingleSignOnToken>
11 0 : {
12 : public Guid Id { get; set; }
13 :
14 : public int Version { get; set; }
15 :
16 : public DateTimeOffset TimeStamp { get; set; }
17 :
18 : #region Implementation of IMessageWithAuthenticationToken<ISingleSignOnToken>
19 :
20 : public ISingleSignOnToken AuthenticationToken { get; set; }
21 :
22 : #endregion
23 :
24 : #region Implementation of IMessage
25 :
26 : [DataMember]
27 : public Guid CorrelationId { get; set; }
28 :
29 : [DataMember]
30 : [Obsolete("Use Frameworks, It's far more flexible and OriginatingFramework")]
31 : public FrameworkType Framework { get; set; }
32 :
33 : /// <summary>
34 : /// The originating framework this message was sent from.
35 : /// </summary>
36 : [DataMember]
37 : public string OriginatingFramework { get; set; }
38 :
39 : /// <summary>
40 : /// The frameworks this <see cref="IMessage"/> has been delivered to/sent via already.
41 : /// </summary>
42 : [DataMember]
43 : public IEnumerable<string> Frameworks { get; set; }
44 :
45 : [Obsolete("Use CorrelationId")]
46 : [DataMember]
47 : public Guid CorrolationId
48 : {
49 : get { return CorrelationId; }
50 : set { CorrelationId = value; }
51 : }
52 :
53 : #endregion
54 : }
55 :
56 : public class TestAggregateDidSomethingElse : IEvent<ISingleSignOnToken>
57 0 : {
58 : public Guid Id { get; set; }
59 :
60 : public int Version { get; set; }
61 :
62 : public DateTimeOffset TimeStamp { get; set; }
63 :
64 : #region Implementation of IMessageWithAuthenticationToken<ISingleSignOnToken>
65 :
66 : public ISingleSignOnToken AuthenticationToken { get; set; }
67 :
68 : #endregion
69 :
70 : #region Implementation of IMessage
71 :
72 : [DataMember]
73 : public Guid CorrelationId { get; set; }
74 :
75 : [DataMember]
76 : [Obsolete("Use Frameworks, It's far more flexible and OriginatingFramework")]
77 : public FrameworkType Framework { get; set; }
78 :
79 : /// <summary>
80 : /// The originating framework this message was sent from.
81 : /// </summary>
82 : [DataMember]
83 : public string OriginatingFramework { get; set; }
84 :
85 : /// <summary>
86 : /// The frameworks this <see cref="IMessage"/> has been delivered to/sent via already.
87 : /// </summary>
88 : [DataMember]
89 : public IEnumerable<string> Frameworks { get; set; }
90 :
91 : [Obsolete("Use CorrelationId")]
92 : [DataMember]
93 : public Guid CorrolationId
94 : {
95 : get { return CorrelationId; }
96 : set { CorrelationId = value; }
97 : }
98 :
99 : #endregion
100 : }
101 :
102 : public class TestAggregateDidSomethingElse2 : TestAggregateDidSomethingElse
103 0 : {
104 : }
105 :
106 : public class TestAggregateDidSomethingHandler : IEventHandler<ISingleSignOnToken, TestAggregateDidSomething>
107 0 : {
108 0 : public void Handle(TestAggregateDidSomething message)
109 : {
110 : lock (message)
111 : {
112 : TimesRun++;
113 : }
114 : }
115 :
116 : public int TimesRun { get; private set; }
117 : }
118 : }
|