Exemplo n.º 1
0
        public void ConvertToIntWhenValidNegativeSymbolShouldReturnEquivalentNumber()
        {
            Exercises testExercise = new Exercises();

            Assert.Equal(-1, testExercise.ConvertToInt("-1"));
        }
Exemplo n.º 2
0
        public void ConvertToIntWhenInvalidCharsShouldThrowException()
        {
            Exercises testExercise = new Exercises();

            Assert.Throws <FormatException>(() => testExercise.ConvertToInt("one"));
        }
Exemplo n.º 3
0
        public void ConvertToIntWhenValidCharsShouldReturnEquivalentNumber()
        {
            Exercises testExercise = new Exercises();

            Assert.Equal(1, testExercise.ConvertToInt("1"));
        }
Exemplo n.º 4
0
        public void ConvertToIntWhenEmptyStringShouldThrowException()
        {
            Exercises testExercise = new Exercises();

            Assert.Throws <FormatException>(() => testExercise.ConvertToInt(""));
        }
Exemplo n.º 5
0
        public void ConvertToIntWhenNullShouldThrowException()
        {
            Exercises testExercise = new Exercises();

            Assert.Throws <ArgumentNullException>(() => testExercise.ConvertToInt(null));
        }
Exemplo n.º 6
0
        public void ConvertToIntWhenLowerThanIntShouldThrowException()
        {
            Exercises testExercise = new Exercises();

            Assert.Throws <OverflowException>(() => testExercise.ConvertToInt("-2147483649"));
        }
Exemplo n.º 7
0
        public void ConvertToIntWhenInvalidNegativeSymbolShouldThrowException()
        {
            Exercises testExercise = new Exercises();

            Assert.Throws <FormatException>(() => testExercise.ConvertToInt("1-"));
        }