public void AmbienceServerRunsWithSpecifiedOptions()
        {
            File.Delete("IntegrationTest.db");

            ProcessTask task = StartAmbienceServer("/db:IntegrationTest.db /p:" + PortNumber + " /u:Test /pw:LetMeIn");

            var config = new AmbienceClientConfiguration()
            {
                Port       = PortNumber,
                Credential = new NetworkCredential("Test", "LetMeIn")
            };

            AmbienceClient        client    = AmbienceClient.Connect(config);
            IAmbientDataContainer container = client.Container;

            container.DeleteAll();

            container.Store(new Item()
            {
                Name = "foo", Value = 42
            });
            container.Store(new Item()
            {
                Name = "bar", Value = 40
            });

            Assert.AreEqual("foo", (from Item x in container where x.Value == 42 select x.Name).Single());
            Assert.AreEqual(0, (from Item x in container where x.Value == 0 select x).Count());

            task.Abort();
        }
        public void HostProgramTerminatesWhenItsOwnerProcessTerminates()
        {
            ProcessTask ownerProcess   = StartHost("/ipc-port:HostIntegrationTest-Owner /timeout:30");
            int         ownerProcessId = ownerProcess.Process.Id;

            ProcessTask task = StartHost("/ipc-port:HostIntegrationTest /owner-process:" + ownerProcessId);

            Assert.IsFalse(task.Join(TimeSpan.FromSeconds(2)), "The host should not have exited yet.");

            ownerProcess.Abort();
            Assert.IsTrue(task.Join(TimeSpan.FromSeconds(5)), "The host should terminate.");

            Assert.Contains(task.ConsoleOutput, "Owner process terminated abruptly!");
            Assert.AreEqual(0, task.ExitCode);
        }