public void Loaded_dispatches_to_interceptors() { var interceptionContext = new DbInterceptionContext(); var eventArgs = new DbConfigurationLoadedEventArgs(new Mock<InternalConfiguration>(null, null, null, null, null).Object); var mockInterceptor1 = new Mock<IDbConfigurationInterceptor>(); var mockInterceptor2 = new Mock<IDbConfigurationInterceptor>(); var dispatcher = new DbConfigurationDispatcher(); var internalDispatcher = dispatcher.InternalDispatcher; internalDispatcher.Add(mockInterceptor1.Object); internalDispatcher.Add(mockInterceptor2.Object); dispatcher.Loaded(eventArgs, interceptionContext); mockInterceptor1.Verify(m => m.Loaded(eventArgs, It.IsAny<DbConfigurationInterceptionContext>()), Times.Once()); mockInterceptor2.Verify(m => m.Loaded(eventArgs, It.IsAny<DbConfigurationInterceptionContext>()), Times.Once()); }
public void Loaded_dispatches_to_interceptors() { var interceptionContext = new DbInterceptionContext(); var eventArgs = new DbConfigurationLoadedEventArgs(new Mock <InternalConfiguration>(null, null, null, null, null).Object); var mockInterceptor1 = new Mock <IDbConfigurationInterceptor>(); var mockInterceptor2 = new Mock <IDbConfigurationInterceptor>(); var dispatcher = new DbConfigurationDispatcher(); var internalDispatcher = dispatcher.InternalDispatcher; internalDispatcher.Add(mockInterceptor1.Object); internalDispatcher.Add(mockInterceptor2.Object); dispatcher.Loaded(eventArgs, interceptionContext); mockInterceptor1.Verify(m => m.Loaded(eventArgs, It.IsAny <DbConfigurationInterceptionContext>()), Times.Once()); mockInterceptor2.Verify(m => m.Loaded(eventArgs, It.IsAny <DbConfigurationInterceptionContext>()), Times.Once()); }
public OnLoaded() { var dispatchers = new Mock<DbDispatchers>(); var snapshot = new Mock<IDbDependencyResolver>().Object; _configuration = CreateMockInternalConfiguration(null, snapshot, () => dispatchers.Object); _interceptor1 = new LoadedInterceptor(_configuration, snapshot); _interceptor2 = new LoadedInterceptor(_configuration, snapshot); _interceptor3 = new LoadedInterceptor(_configuration, snapshot); var d2 = new DbConfigurationDispatcher(); d2.InternalDispatcher.Add(_interceptor1); d2.InternalDispatcher.Add(_interceptor2); d2.InternalDispatcher.Add(_interceptor2); dispatchers.Setup(m => m.Configuration).Returns(d2); }