Ejemplo n.º 1
0
        public void SubtractOperateGivesExpectedOutputWithValidInput()
        {
            Subtract test = new Subtract();

            Assert.AreEqual("0", test.Operate(2, 2));
            Assert.AreEqual("6", test.Operate(8, 2));
            Assert.AreEqual("195", test.Operate(200, 5));
            Assert.AreEqual("-5", test.Operate(-2, 3));
            Assert.AreEqual("0", test.Operate(0, 0));
        }
Ejemplo n.º 2
0
        public void WhenXandYMaxValue_ShouldThrowArgumentOutOfRange(
            [Values(double.MaxValue)] double x,
            [Values(double.MaxValue)] double y)
        {
            var operation = new Subtract(x, y);

            Assert.AreEqual(0, operation.Operate());
        }
Ejemplo n.º 3
0
        public void WhenXMaxValueYMinValue_ShouldArgumentException(
            [Values(double.MaxValue)] double x,
            [Values(double.MinValue)] double y)
        {
            var operation = new Subtract(x, y);

            Assert.Throws <ArgumentException>(() => { var result = operation.Operate(); });
        }
Ejemplo n.º 4
0
        public void SubtractXYNegative(
            [Values(-2, -3)] double x,
            [Values(-4, -5)] double y
            )
        {
            var operation = new Subtract(x, y);

            Assert.AreEqual(x - y, operation.Operate());
        }
Ejemplo n.º 5
0
        public void SubtractXYPositive(
            [Values(2, 3)] double x,
            [Values(4, 5)] double y
            )
        {
            var operation = new Subtract(x, y);

            Assert.AreEqual(x - y, operation.Operate());
        }