public void UseRequestListener() { var instanceTracker = new InstanceTracker(); var sut = Configure(c => c.UseRequestListener(sp => new TestRequestListener(instanceTracker))); RequestListenersShouldBeCreatedOnEnumeration(sut, instanceTracker); }
public void SetUp() { _instanceTracker = new InstanceTracker(); }
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"); }
public TestRequestListener(InstanceTracker tracker) : base(tracker) { }