Esempio n. 1
0
        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));
        }
Esempio n. 2
0
        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));
        }
Esempio n. 3
0
        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));
        }
Esempio n. 4
0
        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));
        }