Example #1
0
        public void MathFunctionHardcode_Within0To1_ReturnsTrue()
        {
            // Arrange
            var obj = new MethodLibrary();

            // Act
            var ret = obj.MathFunction(5);
            var res = ret <= 1 & ret > 0;

            // Assert
            Assert.IsTrue(res);
        }
Example #2
0
        public void MathFunctionHardcode_NotNaN_ReturnsTrue()
        {
            // Arrange
            var obj = new MethodLibrary();


            // Act
            var ret = obj.MathFunction(5);


            // Assert
            Assert.AreNotEqual(ret, Double.NaN);
        }
Example #3
0
        public void MathFunctionHardcode_DivideByZeroException_ShouldBeThrown()
        {
            // Arrange
            var obj = new MethodLibrary();


            // Act
            Func <object> result = () => obj.MathFunction(1);

            Console.WriteLine(result);


            // Assert
            Assert.ThrowsException <DivideByZeroException>(result);
        }
Example #4
0
        public void MathFunctionCSV_NotNaN_ReturnsTrue()
        {
            // Arrange
            var output = ReadCsv(@"D:\Studying\AT\Automated-Testing\LAB1\file.csv");
            var num    = int.Parse(output[0]);
            var obj    = new MethodLibrary();


            // Act
            var ret = obj.MathFunction(5);


            // Assert
            Assert.AreNotEqual(ret, Double.NaN);
        }
Example #5
0
        public void MathFunctionCSV_Within0To1_ReturnsTrue()
        {
            // Arrange
            var output = ReadCsv(@"D:\Studying\AT\Automated-Testing\LAB1\file.csv");
            var num    = int.Parse(output[0]);
            var obj    = new MethodLibrary();


            // Act
            var ret = obj.MathFunction(num);
            var res = ret <= 1 & ret > 0;


            // Assert
            Assert.IsTrue(res);
        }
Example #6
0
        public void MathFunctionRandom__Within0To1_ReturnsTrue()
        {
            // Arrange
            var obj  = new MethodLibrary();
            var rand = new Random();
            var num  = rand.Next(5);


            // Act
            Console.WriteLine(num);
            var ret = obj.MathFunction(5);
            var res = ret <= 1 & ret > 0;


            // Assert
            Assert.IsTrue(res);
        }
Example #7
0
        public void MathFunctionRandom_NotNaN_ReturnsTrue()
        {
            // Arrange
            var obj  = new MethodLibrary();
            var rand = new Random();
            var num  = rand.Next(2, 5);


            // Act
            Console.WriteLine(num);
            var ret = obj.MathFunction(num);

            Console.WriteLine(ret);


            // Assert
            Assert.AreNotEqual(ret, Double.NaN);
        }