public void Save_NoId()
        {
            bool addCalled                = false;
            bool updateCalled             = false;
            ICompanyRepository repository = new StubICompanyRepository
            {
                AddCompany = x =>
                {
                    addCalled = true;
                },
                UpdateCompany = x =>
                {
                    updateCalled = true;
                }
            };

            this.view.CompanyIdField = 0;

            var presenter = new CompanyDetailPresenter(this.view, repository);

            presenter.Save();

            Assert.IsTrue(addCalled);
            Assert.IsFalse(updateCalled);
            Assert.IsTrue((this.view as MockCompanyDetailView).CanUserDelete);
        }
Exemplo n.º 2
0
        protected void SaveButton_Click(object sender, EventArgs e)
        {
            var presenter = new CompanyDetailPresenter(this);

            presenter.Save();
        }