Line data Source code
1 : using System.Collections.Generic;
2 : using System.Linq;
3 : using Cqrs.Authentication;
4 : using Cqrs.Commands;
5 :
6 : namespace Cqrs.Tests.Substitutes
7 : {
8 : public class TestCommandPublisher : ICommandPublisher<ISingleSignOnToken>
9 0 : {
10 0 : public TestCommandPublisher()
11 : {
12 : PublishedCommands = new List<ICommand<ISingleSignOnToken>>();
13 : }
14 :
15 0 : public void Publish<TCommand>(TCommand command)
16 : where TCommand : ICommand<ISingleSignOnToken>
17 : {
18 : PublishedCommands.Add(command);
19 : }
20 :
21 0 : public void Publish<TCommand>(IEnumerable<TCommand> commands)
22 : where TCommand : ICommand<ISingleSignOnToken>
23 : {
24 : PublishedCommands.AddRange(commands.Cast<ICommand<ISingleSignOnToken>>());
25 : }
26 :
27 : public int Published { get { return PublishedCommands.Count; } }
28 :
29 : public List<ICommand<ISingleSignOnToken>> PublishedCommands { get; private set; }
30 : }
31 : }
|