Esempio n. 1
0
        public void AddProjectShouldNotCreateADirectoryIfNoPersistanceDirIsSet()
        {
            var model     = new ProjectModel();
            var view      = new NullView();
            var presenter = new BacklogPresenter(view, model);

            presenter.AddProject("Fairy Tales");
            Assert.IsFalse(Directory.Exists("c:\\Fairy Tales"));
        }
Esempio n. 2
0
        public void ShouldShowCreateProjectControlsIfNoProjectAvailable()
        {
            var view = new NullView();

            var presenter = new BacklogPresenter(view, new ProjectModel());

            view.CreateProjectControlsVisible = false;
            presenter.Present();
            Assert.IsTrue(view.CreateProjectControlsVisible);
        }
Esempio n. 3
0
        public void ProjectsShouldBeSetAfterPresent()
        {
            var view = new NullView();

            var model = new ProjectModel();

            model.AddProject("Fairy Tales");

            var presenter = new BacklogPresenter(view, model);

            presenter.Present();
            Assert.AreEqual(1, model.ListProjects().Length);
        }
Esempio n. 4
0
        public void PresenterShouldNotifyOnProjectNamesThatStartWithADot()
        {
            var view = new NullView();

            var model     = new ProjectModel();
            var presenter = new BacklogPresenter(view, model);

            presenter.AddProject(".project");
            presenter.Present();
            Assert.AreEqual(
                "Fairy Tales does not support project names that starts with a dot (.), please choose another.",
                view.ErrorMessage);
        }
Esempio n. 5
0
        public void ShouldNotHideCreateProjectControlsIfVisibleAndProjectsPresent()
        {
            var view  = new NullView();
            var model = new ProjectModel();

            model.AddProject("My Project");

            var presenter = new BacklogPresenter(view, model);

            view.CreateProjectControlsVisible = true;
            presenter.Present();
            Assert.IsTrue(view.CreateProjectControlsVisible);
        }
Esempio n. 6
0
        public void ShouldNotShowCreateProjectControlsIfProjectsArePresent()
        {
            var view  = new NullView();
            var model = new ProjectModel();

            model.AddProject("My Project");

            var presenter = new BacklogPresenter(view, model);

            view.CreateProjectControlsVisible = false;
            presenter.Present();
            Assert.IsFalse(view.CreateProjectControlsVisible);
        }
Esempio n. 7
0
        public void PresenterShouldClearErrorMessageOnTwoContinousPresents()
        {
            var model     = new ProjectModel();
            var presenter = new BacklogPresenter(new NullView(), model);

            presenter.AddProject(".project");
            presenter.Present();

            var view = new NullView();

            presenter = new BacklogPresenter(view, model);
            presenter.Present();
            Assert.AreEqual(string.Empty, view.ErrorMessage);
        }
Esempio n. 8
0
        public void PresenterShouldNotifyOnDuplicateProjectNames()
        {
            var view = new NullView();

            var model     = new ProjectModel();
            var presenter = new BacklogPresenter(view, model);

            presenter.AddProject("Fairy Tales");
            presenter.AddProject("Fairy Tales");
            presenter.Present();

            Assert.AreEqual(
                "A project with the name <Fairy Tales> allready exists. Please choose another name for your project.",
                view.ErrorMessage);
        }
Esempio n. 9
0
        public void ShouldConstraintStoryTitlesToXCharactersInStoryList()
        {
            var view  = new NullView();
            var model = new ProjectModel();

            model.AddProject("Fairy Tales");
            model.AddStory("FT", "A story with quite long title that should be abbreviated when presented.");
            var presenter = new BacklogPresenter(view, model, new TitleAbbreviator(35));

            presenter.Present();

            var story = view.ActiveProject.Stories[0];

            Assert.That(story.Name, Is.EqualTo("A story with quite long title that ..."));
        }
Esempio n. 10
0
        public void ActiveProjectShouldBeSetAfterPresent()
        {
            var view = new NullView();

            var model = new ProjectModel();

            model.AddProject("Fairy Tales");
            model.AddProject("Troy");

            var presenter = new BacklogPresenter(view, model);

            presenter.Present();
            Assert.AreEqual("Troy", model.GetActiveProject().Name);
            Assert.AreEqual(view.ActiveProject.Name, model.GetActiveProject().Name);
        }
Esempio n. 11
0
        public void ShouldBeAbleToAddAStoryFilterThatFiltersStories()
        {
            var model     = new ProjectModel();
            var view      = new NullView();
            var presenter = new BacklogPresenter(view, model);

            presenter.AddProject("Fairy Tales");
            presenter.AddStoryToActiveProject("Not Started Story");

            presenter.Present();
            Assert.AreEqual(1, view.ActiveProject.Stories.Length);

            var filter = new StoryFilter();

            filter.AddStoryFilter <StoryNotStarted>();
            model.AddStoryFilter(filter);
            presenter.Present();
            Assert.AreEqual(0, view.ActiveProject.Stories.Length);
        }