public void Load_Id()
        {
            bool methodCalled             = false;
            ICompanyRepository repository = new StubICompanyRepository
            {
                GetByIdInt32 = x =>
                {
                    methodCalled = true;
                    return(new Company {
                        Id = x, Name = "Test Company"
                    });
                }
            };

            this.view.CompanyIdField = 3;

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

            presenter.Load();
            Assert.IsTrue(methodCalled);

            Assert.IsTrue((this.view as MockCompanyDetailView).CanUserDelete);
            Assert.AreEqual(3, this.view.CompanyIdField);
            Assert.AreEqual("Test Company", this.view.NameField);
        }
示例#2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!this.IsPostBack)
            {
                if (this.IsQueryStringValid("id0"))
                {
                    this.CompanyIdField = Convert.ToInt32(this.Request.QueryString.Get("id0"));
                }

                var presenter = new CompanyDetailPresenter(this);
                presenter.Load();
            }
        }