public void TransferableVisualState_BoundProjectManagement()
        {
            // Setup
            var testSubject = new TransferableVisualState();
            var server = new ServerViewModel(new Integration.Service.ConnectionInformation(new System.Uri("http://server")));
            var project1 = new ProjectViewModel(server, new Integration.Service.ProjectInformation());
            var project2 = new ProjectViewModel(server, new Integration.Service.ProjectInformation());

            // Act (bind to something)
            testSubject.SetBoundProject(project1);

            // Verify
            Assert.IsTrue(testSubject.HasBoundProject);
            Assert.IsTrue(project1.IsBound);
            Assert.IsFalse(project2.IsBound);
            Assert.IsFalse(server.ShowAllProjects);

            // Act (bind to something else)
            testSubject.SetBoundProject(project2);

            // Verify
            Assert.IsTrue(testSubject.HasBoundProject);
            Assert.IsFalse(project1.IsBound);
            Assert.IsTrue(project2.IsBound);
            Assert.IsFalse(server.ShowAllProjects);

            // Act(clear binding)
            testSubject.ClearBoundProject();

            // Verify
            Assert.IsFalse(testSubject.HasBoundProject);
            Assert.IsFalse(project1.IsBound);
            Assert.IsFalse(project2.IsBound);
            Assert.IsTrue(server.ShowAllProjects);
        }
        public void TransferableVisualState_DefaultState()
        {
            // Setup
            var testSubject = new TransferableVisualState();

            // Verify
            Assert.IsFalse(testSubject.HasBoundProject);
            Assert.IsFalse(testSubject.IsBusy);
            Assert.IsNotNull(testSubject.ConnectedServers);
            Assert.AreEqual(0, testSubject.ConnectedServers.Count);
        }
        public StateManager(IHost host, TransferableVisualState state)
        {
            if (host == null)
            {
                throw new ArgumentNullException(nameof(host));
            }

            if (state == null)
            {
                throw new ArgumentNullException(nameof(state));
            }

            this.Host         = host;
            this.ManagedState = state;
            this.ManagedState.PropertyChanged += this.OnStatePropertyChanged;
        }
        public StateManager(IHost host, TransferableVisualState state)
        {
            if (host == null)
            {
                throw new ArgumentNullException(nameof(host));
            }

            if (state == null)
            {
                throw new ArgumentNullException(nameof(state));
            }

            this.Host = host;
            this.ManagedState = state;
            this.ManagedState.PropertyChanged += this.OnStatePropertyChanged;
        }