public void CallbackCallOnExpectation()
 {
     //Arrange
     var mocks = new MockRepository();
     IProjectRepository repository = mocks.StrictMock<IProjectRepository>();
     IProjectView view = mocks.StrictMock<IProjectView>();
     Expect.Call(view.Ask(null, null)).Callback(new Delegates.Function<bool,object, object> (onAskCallback)).Return(null);
     mocks.ReplayAll();
     //Act
     ProjectPresenter presenter = new ProjectPresenter(view);
     presenter.Ask(null, null);
     //Assert
     mocks.VerifyAll();
 }
        public void SaveProjectAs_NewNameWithoutConflicts()
        {
            //Arrange

            var mocks = new MockRepository();
            IProjectView projectView = mocks.StrictMock<IProjectView>();
            IProjectRepository repository = mocks.StrictMock<IProjectRepository>();

            string newProjectName = "Foo";
            Project prj = new Project("Foo");
            IProjectPresenter projectPresenter = new ProjectPresenter(projectView, repository, prj);
            using (mocks.Ordered())
            {
                Expect.Call(projectView.Title).Return(prj.Name);
                Expect.Call(repository.GetProjectByName(newProjectName)).Return(null);
                projectView.Title = newProjectName;
                projectView.HasChanges = false;
                repository.SaveProject(prj);
            }

            mocks.ReplayAll();
            //Act
            projectPresenter.SaveProjectAs();
            //Assert
            mocks.VerifyAll();
        }
 public void Project_view()
 {
     //Arrange
     var mocks = new MockRepository();
     IProjectView projectView = mocks.StrictMock<IProjectView>();
     Expect.Call(projectView.Title).Return("Project Title");
     mocks.ReplayAll();
     var sut = new ProjectPresenter(projectView);
     //Act
     sut.GetProjectTitle();
     //Assert
     mocks.VerifyAll();
 }
 public void SaveProjectAs_CanBeCanceled()
 {
     //Arrange
     var mocks = new MockRepository();
     IProjectView projectView = mocks.StrictMock<IProjectView>();
     Project prj = new Project("Example Project");
     IProjectPresenter presenter = new ProjectPresenter(projectView, prj);
     Expect.Call(projectView.Title).Return(prj.Name);
     //Expect.Call(projectView.Ask(question, asnwer))
     mocks.ReplayAll();
     //Act
     Assert.IsFalse(presenter.SaveProjectAs());
     //Assert
     mocks.VerifyAll();
 }