using System; using System.Collections.Generic; using DotNetOpenId.RelyingParty; namespace DotNetOpenId.Test.Mocks { class DirectMessageSniffWrapper : IDirectMessageChannel { IDirectMessageChannel channel; internal DirectMessageSniffWrapper(IDirectMessageChannel channel) { this.channel = channel; } internal event Action> Sending; internal event Action> Receiving; protected virtual void OnSending(ServiceEndpoint provider, IDictionary fields) { var sending = Sending; if (sending != null) { sending(provider, fields); } } protected virtual void OnReceiving(ServiceEndpoint provider, IDictionary fields) { var receiving = Receiving; if (receiving != null) { receiving(provider, fields); } } #region IDirectMessageChannel Members public IDictionary SendDirectMessageAndGetResponse(ServiceEndpoint provider, IDictionary fields) { OnSending(provider, fields); var results = channel.SendDirectMessageAndGetResponse(provider, fields); OnReceiving(provider, results); return results; } #endregion } }