Ejemplo 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"));
        }
Ejemplo 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);
        }
Ejemplo n.º 3
0
        public void PresenterShouldTrimProjectNamesUponCreation()
        {
            var model     = new ProjectModel();
            var presenter = new BacklogPresenter(new NullView(), model);

            presenter.AddProject(" test project ");

            Project active = model.GetActiveProject();

            Assert.AreEqual("TP", active.Abbreviation);
            Assert.AreEqual("test project", active.Name);
        }
Ejemplo n.º 4
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);
        }
Ejemplo n.º 5
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);
        }
Ejemplo n.º 6
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);
        }
Ejemplo n.º 7
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);
        }
Ejemplo n.º 8
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);
        }
Ejemplo n.º 9
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);
        }
Ejemplo n.º 10
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 ..."));
        }
Ejemplo n.º 11
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);
        }
Ejemplo n.º 12
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);
        }