Exemple #1
0
        public void ShouldBeAbleToRegisterListenersIfRegistryIsUp()
        {
            NetworkRegistry.GetOrAdd(WellKnown.EndPoints.Free1);

            Assert.That(NetworkRegistry.Get().Any(x => x.Equals(WellKnown.EndPoints.Free1)), Is.True);

            NetworkRegistry.Register(WellKnown.Listeners.AlphaListener, "alpha");
            Assert.That(NetworkRegistry.List().Any(x => x.ToEndPoint().Equals(WellKnown.EndPoints.Alpha)), Is.True);
        }
Exemple #2
0
        public void ShouldBeAbleToLaunchServiceInASeparateProcess()
        {
            R.GetOrAdd(WellKnown.Listeners.AlphaListener.EndPoint);

            var service = new SqlDServiceModel()
            {
                Name     = "separate-process",
                Database = SqlDStart.NewId(),
                Port     = WellKnown.EndPoints.Free2.Port - 100,
                Host     = WellKnown.EndPoints.Free2.Host,
                Pragma   = SqlDPragmaModel.Default
            };

            using (var process = SqlD.Process.Service.Start(typeof(StartTests).Assembly, service))
            {
                var wait = new ManualResetEvent(false);
                using (var endPointMonitor = new EndPointMonitor(service.ToEndPoint()))
                {
                    endPointMonitor.OnUp += (args) => wait.Set();
                    wait.WaitOne(TimeSpan.FromSeconds(30));
                }
                process.Kill();
            }
        }