public void SetUp() { _scopedAppServiceProviderMock = new Mock <IScopedAppServiceProvider>(MockBehavior.Strict); _scopedSubscriptionsServiceMock = new Mock <IScopedSubscriptionsService>(MockBehavior.Strict); _eventsScopeSubscriptionsFeature = new EventsScopeSubscriptionsFeature(_scopedAppServiceProviderMock.Object); }
public void GetSubscriptionsFeature_ShouldGerOrAddFeatureFromEventsContext() { var feature = new EventsScopeSubscriptionsFeature(_scopedAppServiceProviderMock.Object); Func <IScopedAppServiceProvider, IEventsScopeSubscriptionsFeature> factory = null; _eventsScopeMock .Setup( x => x.GetOrAddFeature(It.IsAny <Func <IScopedAppServiceProvider, IEventsScopeSubscriptionsFeature> >()) ) .Callback <Func <IScopedAppServiceProvider, IEventsScopeSubscriptionsFeature> >( x => factory = x ) .Returns(feature) .Verifiable(); var returnedFeature = _eventsScopeMock.Object.GetSubscriptionsFeature(); var factoryFeature = factory(_scopedAppServiceProviderMock.Object); Assert.That(returnedFeature, Is.EqualTo(feature)); Assert.That(factoryFeature, Is.TypeOf <EventsScopeSubscriptionsFeature>()); }