예제 #1
0
        public void Multiplication_ShouldMultiply()
        {
            var obj      = new Object();
            var expected = 8;

            var actual = obj.Multiplication(4, 2);

            Assert.Equal(expected, actual);
        }
예제 #2
0
        public void SafeDivision_ShouldDivide()
        {
            var obj      = new Object();
            var expected = 2;

            var actual = obj.SafeDivision(4, 2);

            Assert.Equal(expected, actual);
        }
예제 #3
0
        public void SafeDivision_ShouldThrowException()
        {
            var testObject = new Object();

            Action act = () => testObject.divided = testObject.SafeDivision(5, 0);

            var exception = Assert.Throws <DivideByZeroException>(act);

            Assert.Equal("Attempted to divide by zero.", exception.Message);
        }