コード例 #1
0
        public void CloneButtonIsOnlyHiddenOnce()
        {
            var view = Mocks.StrictMock<CloneView>();

            view.Expect(v => v.ShowCloneButton()).Repeat.Once();
            view.Expect(v => v.HideCloneButton()).Repeat.Once();

            view.RepositoryToClone = null;
            LastCall.PropertyBehavior();

            view.DestinationFolder = null;
            LastCall.PropertyBehavior();

            Mocks.ReplayAll();

            view.RepositoryToClone = "some value";
            view.DestinationFolder = "more value";

            var presenter = new ClonePresenter(view);

            presenter.DestionFolderTextChanged();

            Assert.That(presenter.IsCloneButtonShown, Is.True);

            view.RepositoryToClone = null;
            view.DestinationFolder = null;

            presenter.DestionFolderTextChanged();

            Assert.That(presenter.IsCloneButtonShown, Is.False);

            view.RepositoryToClone = null;
            view.DestinationFolder = null;

            presenter.DestionFolderTextChanged();

            Assert.That(presenter.IsCloneButtonShown, Is.False);
        }
コード例 #2
0
        public void WhenRepositoryIsNotPopulatedTheCloneButtonIsNotShown()
        {
            CloneView view = SetUpTestForHideCloneButton();

            var presenter = new ClonePresenter(view);

            view.RepositoryToClone = "value";
            view.DestinationFolder = "some value";

            presenter.DestionFolderTextChanged();

            view.RepositoryToClone = null;
            view.DestinationFolder = "some value";

            presenter.DestionFolderTextChanged();

            Assert.That(presenter.IsCloneButtonShown, Is.False);
        }
コード例 #3
0
        public void WhenRepositoryAndDestinaitonArePopulatedCloneButtonIsShown()
        {
            CloneView view = SetUpTestForDisplayCloneButton();

            view.RepositoryToClone = "some value";
            view.DestinationFolder = "some value, can be same of different";

            var presenter = new ClonePresenter(view);

            presenter.DestionFolderTextChanged();

            Assert.That(presenter.IsCloneButtonShown, Is.True);
        }
コード例 #4
0
        public void WhenCloneButtonIsVisibleItNotDisplayedAgain()
        {
            var view = Mocks.StrictMock<CloneView>();

            view.Expect(v => v.ShowCloneButton()).Repeat.Once();

            view.SetPropertyAsBehavior(v => v.RepositoryToClone);
            view.SetPropertyAsBehavior(v => v.DestinationFolder);

            Mocks.ReplayAll();

            view.RepositoryToClone = "some value";
            view.DestinationFolder = "more value";

            var presenter = new ClonePresenter(view);

            presenter.DestionFolderTextChanged();

            Assert.That(presenter.IsCloneButtonShown, Is.True);

            view.RepositoryToClone = "changes value";
            view.DestinationFolder = "other changes value";

            presenter.DestionFolderTextChanged();

            Assert.That(presenter.IsCloneButtonShown, Is.True);
        }