public void Given_X_And_Y_Then_Should_Div_Operation_Compute_Their_Division(decimal x, decimal y, decimal expectedDiv) { // arrange var superComputer = new SuperComputer(); // act var div = superComputer.Div(x, y); // assert div.Should().Be(expectedDiv); }
public void Given_Y_Equals_To_Zero_Then_Div_Should_Throw_SuperComputerException() { // arrange var superComputer = new SuperComputer(); // act Action divAction = () => superComputer.Div(decimal.MaxValue, 0); // assert divAction.Should().Throw <SuperComputerException>(); }
public static void Main() { var x = Random.Next(1, 10_000); var y = Random.Next(1, 10_000); Console.WriteLine($"x = {x}"); Console.WriteLine($"y = {y}"); var superComputer = new SuperComputer(); var sum = superComputer.Sum(x, y); var sub = superComputer.Sub(x, y); var mul = superComputer.Mul(x, y); var div = superComputer.Div(x, y); Console.WriteLine($"x + y = {sum}"); Console.WriteLine($"x - y = {sub}"); Console.WriteLine($"x * y = {mul}"); Console.WriteLine($"x / y = {div}"); Console.WriteLine("Press any key to exit program !"); Console.ReadKey(); }