Exemplo n.º 1
0
        public void ExcludedIsClearedAfterRefresh()
        {
            //arrange
            _viewMock.SetupProperty(v => v.ExcludedChanges);
            var presenter = new ChangesPresenter(_viewMock.Object, _providerMock.Object);

            _viewMock.Object.ExcludedChanges = new List <IFileStatusEntry>()
            {
                new FileStatusEntry(@"C:\path\to\module.bas", FileStatus.Modified)
            };

            Assert.IsTrue(_viewMock.Object.ExcludedChanges.Any(), "No changes found prior to refresh. Issue with Test code.");

            //act
            presenter.RefreshView();

            //
            Assert.IsFalse(_viewMock.Object.ExcludedChanges.Any());
        }
Exemplo n.º 2
0
        public void RefreshDisplaysChangedFiles()
        {
            //arrange
            var fileStatusEntries = new List <FileStatusEntry>()
            {
                new FileStatusEntry(@"C:\path\to\module.bas", FileStatus.Modified),
                new FileStatusEntry(@"C:\path\to\class.cls", FileStatus.Unaltered),
                new FileStatusEntry(@"C:\path\to\added.bas", FileStatus.Added | FileStatus.Modified),
                new FileStatusEntry(@"C:\path\to\untracked.frx", FileStatus.Untracked)
            };

            _viewMock.SetupProperty(v => v.IncludedChanges);
            _viewMock.SetupProperty(v => v.UntrackedFiles);
            _providerMock.Setup(git => git.Status()).Returns(fileStatusEntries);

            var presenter = new ChangesPresenter(_viewMock.Object, _providerMock.Object);

            //act
            presenter.RefreshView();

            //Assert
            Assert.AreEqual(2, _viewMock.Object.IncludedChanges.Count, "Incorrect Included Changes");
            Assert.AreEqual(@"C:\path\to\untracked.frx", _viewMock.Object.UntrackedFiles[0].FilePath);
        }