public void Should_Divide_a_numerator_by_a_denominator_different_of_zero_when_authorization_is_accepted() { IAuthorizer authorizer = new AllowAccessAuthorizer(); Calculator calculator = new Calculator(authorizer); int numerator = 4; int denominator = 2; var result = calculator.Divide(numerator, denominator); Assert.AreEqual(2, result); }
public void Should_throw_an_exception_when_Divide_by_zero() { IAuthorizer authorizer = new AllowAccessAuthorizer(); Calculator calculator = new Calculator(authorizer); int numerator = new Random().Next(); int denominator = 0; Assert.ThrowsException <InvalidOperationException>(() => { calculator.Divide(numerator, denominator); }); }