예제 #1
0
        public void Test_ConvertToInt_String_is_Number_and_has_WhiteSpacesAtTheEnd()
        {
            //Given, When
            int conversion = StringOperations.ConvertStringToInt("123 ");

            //Then
            Assert.Equal(123, conversion);
        }
예제 #2
0
        public void Test_ConvertToInt_Should_Throw_Exception_String_is_NOT_int()
        {
            //Given, When
            Action exception = () => StringOperations.ConvertStringToInt("abc");

            //Then
            Assert.Throws <FormatException>(exception);
        }
예제 #3
0
        public void Test_ConvertToInt_Should_work_correctly_when_string_is_Number()
        {
            //Given, When
            int conversion = StringOperations.ConvertStringToInt("123");

            //Then
            Assert.Equal(123, conversion);
        }
예제 #4
0
        public void Test_ConvertToInt_Should_Throw_exception_String_contains_Digits_and_is_NOT_Number()
        {
            //Given, When
            Action conversion = () => StringOperations.ConvertStringToInt("1a");

            //Then
            Assert.Throws <FormatException>(conversion);
        }