public void DivideTest4() { BLclass B = new BLclass(); var Ex = Assert.ThrowsException <FormatException>(() => B.Divide("abc", "xyz")); Assert.AreEqual("only numbers", Ex.Message); }
public void DivideTest2() { //Arrange-Declare actuals and expected int numerator = 0; int denominator = 2; int Expected = 0; //Act-call the method and pass the actuals as parameters BLclass B = new BLclass(); int Actual = B.Divide(numerator.ToString(), denominator.ToString()); //Assert-check whether actuals are match with expected Assert.AreEqual(Expected, Actual); }
protected void Button1_Click(object sender, EventArgs e) { BLclass BL = new BLclass(); try { txtResult.Text = (BL.Divide(int.Parse(txtNumerator.Text), int.Parse(txtDenominator.Text))).ToString(); } catch (DivideByZeroException E) { Response.Write(E.Message); } }
protected void Button1_Click(object sender, EventArgs e) { BLclass B = new BLclass(); try { txtresult.Text = B.Divide(txtnum.Text, txtdeno.Text).ToString(); } catch (DivideByZeroException E) { Response.Write(E.Message); } catch (FormatException E) { Response.Write(E.Message); } }
public void DivideTest2() { // Arrange - Declare actuals and expected int Numerator = 0; int Denominator = 2; int expected = 0; // Act - call the method and pass the actuals as parameters BLclass B = new BLclass(); int actual = B.Divide(Numerator, Denominator); // Assert - Check Whether actuals are matching with expected Assert.AreEqual(expected, actual); }
public void DivideTest3() { BLclass B = new BLclass(); int numerator = 10; int denominator = 0; var Ex = Assert.ThrowsException <DivideByZeroException>(() => B.Divide(numerator.ToString(), denominator.ToString())); Assert.AreEqual("cannot divide by 0", Ex.Message); }
public void DivideTest3() { // Arrange - Declare actuals and expected int Numerator = 10; int Denominator = 0; BLclass BL = new BLclass(); var ex = Assert.ThrowsException <DivideByZeroException>(() => BL.Divide(Numerator, Denominator)); Assert.AreEqual("Cannot Divide by zero", ex.Message); }