コード例 #1
0
        /// <summary>
        /// Creates a new backend with an in-memory store
        /// </summary>
        /// <param name="auditConsumer">Interface to an object that can consume audit events</param>
        /// <returns>Backend instance</returns>
        private static RingMasterBackendCore CreateBackend(IRingMasterAudit auditConsumer)
        {
            var backendStarted = new ManualResetEventSlim();

            RingMasterBackendCore.GetSettingFunction = settingName => null;
            var backend = new RingMasterBackendCore(new InMemoryFactory(), auditConsumer);

            backend.StartService = (p1, p2) => { backendStarted.Set(); };
            backend.Start(CancellationToken.None);
            backend.OnBecomePrimary();

            backendStarted.Wait(30000).Should().BeTrue();
            return(backend);
        }
コード例 #2
0
        /// <summary>
        /// Creates a new backend with an in-memory store
        /// </summary>
        /// <param name="auditConsumer">Interface to an object that can consume audit events</param>
        /// <returns>Backend instance</returns>
        protected static RingMasterBackendCore CreateBackend(IRingMasterAudit auditConsumer)
        {
            var backendStarted = new ManualResetEventSlim();

            Trace.TraceInformation("RingMasterBackendCoreUnitTest.CreateBackend");

            RingMasterBackendCore.GetSettingFunction = GetSetting;
            var backend = new RingMasterBackendCore(new InMemoryFactory(), auditConsumer);

            backend.StartService = (p1, p2) => { backendStarted.Set(); };
            backend.Start(CancellationToken.None);
            backend.OnBecomePrimary();
            backendStarted.Wait(30000).Should().BeTrue();
            Trace.TraceInformation("RingMasterBackendCoreUnitTest.BackendStarted");
            return(backend);
        }