public void ApplicationCoordinatorRefreshAdd()
        {
            ApplicationElement element1 = new ApplicationElement() { ApplicationPath = ApplicationUtils.CreateValidExampleApplication(), Framework = Framework };
            ApplicationElement element2 = new ApplicationElement() { ApplicationPath = ApplicationUtils.CreateValidExampleApplication(), Framework = Framework };
            ApplicationElement element3 = new ApplicationElement() { ApplicationPath = ApplicationUtils.CreateValidExampleApplication(), Framework = Framework };

            using (ApplicationCoordinator coordinator = new ApplicationCoordinator(Logger, Path.GetFullPath("Collar.exe")))
            {
                coordinator.StartAndRefresh(new ApplicationElement[] { element1, element2 });
                Assert.IsTrue(coordinator.IsRunning);

                var paths = coordinator.GetCoordinatedApplicationPaths();
                Assert.AreEqual(2, coordinator.Count);
                Assert.IsTrue(paths.Contains(element1.ApplicationPath));
                Assert.IsTrue(paths.Contains(element2.ApplicationPath));

                coordinator.StartAndRefresh(new ApplicationElement[] { element1, element2, element3 });
                Assert.IsTrue(coordinator.IsRunning);

                paths = coordinator.GetCoordinatedApplicationPaths();
                Assert.AreEqual(3, coordinator.Count);
                Assert.IsTrue(paths.Contains(element1.ApplicationPath));
                Assert.IsTrue(paths.Contains(element2.ApplicationPath));
                Assert.IsTrue(paths.Contains(element3.ApplicationPath));
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Disposes of resources used by this instance.
        /// </summary>
        /// <param name="disposing">A value indicating whether to dispose of managed resources.</param>
        protected override void Dispose(bool disposing)
        {
            if (!this.disposed)
            {
                if (disposing)
                {
                    this.DestroyWatcher();

                    if (this.components != null)
                    {
                        this.components.Dispose();
                        this.components = null;
                    }

                    if (this.coordinator != null)
                    {
                        this.coordinator.Dispose();
                        this.coordinator = null;
                    }
                }

                this.disposed = true;
            }

            base.Dispose(disposing);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Disposes of resources used by this instance.
        /// </summary>
        /// <param name="disposing">A value indicating whether to dispose of managed resources.</param>
        protected override void Dispose(bool disposing)
        {
            if (!this.disposed)
            {
                if (disposing)
                {
                    this.DestroyWatcher();

                    if (this.components != null)
                    {
                        this.components.Dispose();
                        this.components = null;
                    }

                    if (this.coordinator != null)
                    {
                        this.coordinator.Dispose();
                        this.coordinator = null;
                    }
                }

                this.disposed = true;
            }

            base.Dispose(disposing);
        }