public void TransferableVisualState_BoundProjectManagement() { // Arrange var testSubject = new TransferableVisualState(); var server = new ServerViewModel(new ConnectionInformation(new System.Uri("http://server"))); var project1 = new ProjectViewModel(server, new SonarQubeProject("", "")); var project2 = new ProjectViewModel(server, new SonarQubeProject("", "")); // Act (bind to something) testSubject.SetBoundProject(project1); // Assert testSubject.HasBoundProject.Should().BeTrue(); project1.IsBound.Should().BeTrue(); project2.IsBound.Should().BeFalse(); server.ShowAllProjects.Should().BeFalse(); // Act (bind to something else) testSubject.SetBoundProject(project2); // Assert testSubject.HasBoundProject.Should().BeTrue(); project1.IsBound.Should().BeFalse(); project2.IsBound.Should().BeTrue(); server.ShowAllProjects.Should().BeFalse(); // Act(clear binding) testSubject.ClearBoundProject(); // Assert testSubject.HasBoundProject.Should().BeFalse(); project1.IsBound.Should().BeFalse(); project2.IsBound.Should().BeFalse(); server.ShowAllProjects.Should().BeTrue(); }
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); }