public MainForm(ITabsRepoBuilder tabsRepoBuilder, IAppSemaphoreSlim appSemaphoreSlim, IServiceProvider serviceProvider, IAppConfiguration appConfiguration, ILogger <MainForm> loggingService) { InitializeComponent(); semaphore = appSemaphoreSlim; semaphore.OnUse += SemaphoreIsUsed; this.loggingService = loggingService; this.appConfiguration = appConfiguration; this.tabsRepoBuilder = tabsRepoBuilder; this.serviceProvider = serviceProvider; }
public void BeforeEach() { var methodInfo1 = GetType().GetMethod("Execute"); var methodInfo2 = GetType().GetMethod("NoExecute"); invocation1 = Mock.Of <Castle.DynamicProxy.IInvocation>(); Mock.Get(invocation1).Setup(i => i.Method).Returns(methodInfo1); Mock.Get(invocation1).Setup(i => i.Proceed()).Callback(Execute); invocation2 = Mock.Of <Castle.DynamicProxy.IInvocation>(); Mock.Get(invocation2).Setup(i => i.Method).Returns(methodInfo2); Mock.Get(invocation2).Setup(i => i.Proceed()).Callback(NoExecute); appSemaphoreSlim = Mock.Of <IAppSemaphoreSlim>(); hasExecuted = default; semaphoreInteractionInterceptor = new SemaphoreInteractionInterceptor(appSemaphoreSlim); }
public SemaphoreInteractionInterceptor(IAppSemaphoreSlim appSemaphoreSlim) => operationSemaphore = appSemaphoreSlim ?? throw new ArgumentNullException(nameof(appSemaphoreSlim));