示例#1
0
        public void AgeTest2()
        {
            //arrange-Declare actuals and expected
            DateTime age      = DateTime.Parse("09/06/1955");
            blClass  b        = new blClass();
            var      expected = Assert.ThrowsException <customException>(() => b.calculate(age));

            Assert.AreEqual("maximum age is 60", expected.Message);
        }
示例#2
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            blClass b = new blClass();

            try
            {
                int age = b.calculate(DateTime.Parse(TextBox1.Text));
                Label1.Text = "age is :" + age.ToString();
            }
            catch (Exception E)
            {
                Response.Write(E.Message);
            }
        }