Exemplo n.º 1
0
        private static void RequestListenersShouldBeCreatedOnEnumeration(ISlackServiceProvider sut, InstanceTracker instanceTracker)
        {
            var listeners = sut.GetRequestListeners();

            instanceTracker.GetInstances <TestRequestListener>().ShouldBeEmpty("Listeners should not be created until enumerated");

            var expectedListeners = new[] { listeners.Last(), listeners.Last() };
            var createdInstances  = instanceTracker.GetInstances <TestRequestListener>().Cast <ISlackRequestListener>();

            createdInstances.ShouldMatchReferences(expectedListeners, "Listeners should be created once per enumeration");
        }
Exemplo n.º 2
0
        protected static void DuringRequest(ISlackServiceProvider services, Action <SlackRequestContext> duringRequest)
        {
            var requestContext = new SlackRequestContext();
            var requestScope   = requestContext.BeginRequest(services.GetRequestListeners());

            try
            {
                duringRequest(requestContext);
            }
            finally
            {
                requestScope.DisposeAsync().AsTask().ShouldComplete();
            }
        }
Exemplo n.º 3
0
 public IEnumerable <ISlackRequestListener> GetRequestListeners() => _baseProvider.GetRequestListeners();