public void SolutionEventsServiceOpenedIsInvokedInConstructor() { // Arrange const string solutionName = "SolutionName"; Mock <ISolutionEventsService> solutionEventsServiceMock; var service = CreateViewModelService(out solutionEventsServiceMock); solutionEventsServiceMock .Setup(s => s.Opened()) .Raises(s => s.SolutionNameChanged += null, null, new SolutionNameChangedEventArgs(solutionName)); // Act var window = new WorkingFilesWindow(); // Assert solutionEventsServiceMock.Verify(s => s.Opened()); var expectedCaption = $"{DefaultCaption} [{solutionName}]"; Assert.That(window.Caption, Is.EqualTo(expectedCaption)); }
public void DefaultCaptionIsDisplayedOnWindowCreation() { // Arrange Mock <ISolutionEventsService> solutionEventsServiceMock; var service = CreateViewModelService(out solutionEventsServiceMock); // Act var window = new WorkingFilesWindow(); // Assert Assert.That(window.Caption, Is.EqualTo(DefaultCaption)); }
public void DefaultCaptionIsDisplayedWhenSolutionNameIsEmptyString() { // Arrange Mock <ISolutionEventsService> solutionEventsServiceMock; var service = CreateViewModelService(out solutionEventsServiceMock); var window = new WorkingFilesWindow(); solutionEventsServiceMock.Raise(s => s.SolutionNameChanged += null, new SolutionNameChangedEventArgs("SolutionName")); // Act solutionEventsServiceMock.Raise(s => s.SolutionNameChanged += null, null, new SolutionNameChangedEventArgs(string.Empty)); // Assert Assert.That(window.Caption, Is.EqualTo(DefaultCaption)); }
public void CaptionIncludesSolutionNameWhenSolutionNameIsPresent() { // Arrange const string solutionName = "SolutionName"; Mock <ISolutionEventsService> solutionEventsServiceMock; var service = CreateViewModelService(out solutionEventsServiceMock); var window = new WorkingFilesWindow(); // Act solutionEventsServiceMock.Raise(s => s.SolutionNameChanged += null, null, new SolutionNameChangedEventArgs(solutionName)); // Assert var expectedCaption = $"{DefaultCaption} [{solutionName}]"; Assert.That(window.Caption, Is.EqualTo(expectedCaption)); }