Example #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            _presenter = new VitalsPresenter(this, Data);

            if (!Page.IsPostBack)
            {
                _presenter.Initialize();
            }
        }
Example #2
0
        public void DropDownList_Value_Is_Not_Valid()
        {
            var view      = new MockVitalsView();
            var presenter = new VitalsPresenter(view);

            view.EmployeeId = "";

            Assert.IsFalse(presenter.IsValidEmployeeId());
        }
Example #3
0
        public void EmployeeGridList_Has_Data()
        {
            IVitalsView   view = new MockVitalsView();
            IEmployeeData data = new MockEmployeeData();

            var presenter = new VitalsPresenter(view, data);

            Assert.IsTrue(presenter.GetEmployeeGridList().Count > 0);
        }
Example #4
0
        public void Display_Message_When_No_User_Is_Selected_In_Dropdown()
        {
            var view      = new MockVitalsView();
            var presenter = new VitalsPresenter(view);

            view.EmployeeId = string.Empty;
            presenter.RefreshGridView();

            Assert.AreEqual(view.ErrorMessage, VitalsPresenter.ERROR_MESSAGE_BAD_EMPLOYEE_ID);
        }
Example #5
0
        public void Name_And_SSN_Data_Are_Valid()
        {
            var view      = new MockVitalsView();
            var presenter = new VitalsPresenter(view);

            view.Name = "John Doe";
            view.SSN  = "123-45-6789";

            Assert.IsTrue(presenter.OnOk());
        }
Example #6
0
        public void Initialize_View()
        {
            var           view      = new MockVitalsView();
            IEmployeeData data      = new MockEmployeeData();
            var           presenter = new VitalsPresenter(view, data);

            presenter.Initialize();

            Assert.Greater(presenter.GetEmployeeGridList().Count, 1);
        }
Example #7
0
        public void Display_No_Message_When_User_Is_Selected_In_Dropdown()
        {
            var           view      = new MockVitalsView();
            IEmployeeData data      = new MockEmployeeData();
            var           presenter = new VitalsPresenter(view, data);

            view.EmployeeId = "1";
            presenter.RefreshGridView();

            Assert.AreEqual(view.ErrorMessage, string.Empty);
        }
Example #8
0
        public void Search_EmployeeList_By_Id_Returns_Charles_Smith()
        {
            IVitalsView   view = new MockVitalsView();
            IEmployeeData data = new MockEmployeeData();

            var presenter = new VitalsPresenter(view, data);

            List <Employee> emp = presenter.GetEmployeeGridListById(2);

            string fullName = string.Empty;

            foreach (var item in emp)
            {
                fullName = item.FullName;
            }

            Assert.AreEqual("Smith, Charles", fullName);
        }