Exemple #1
0
        public void Should_ReturnNum_EvenWithLowerCaseParams(string romanNum, int ans)
        {
            //Given
            //When
            int integerNum = RomanConverter.ConvertRoman(romanNum);

            //Then
            integerNum.Should().Be(ans);
        }
Exemple #2
0
        public void Should_ReturnSubtractionOfNumerals(string romanNum, int answer)
        {
            //Given
            //When
            int integerNum = RomanConverter.ConvertRoman(romanNum);

            //Then
            integerNum.Should().Be(answer);
        }
Exemple #3
0
        public void Should_ThrowException_WhenGivenInvalidInput(string romanNum)
        {
            //Given
            //When
            Action action = () => RomanConverter.ConvertRoman(romanNum);

            //Then
            action.Should().Throw <KeyNotFoundException>();
        }
Exemple #4
0
        public void Should_ThrowError_WhenNegativeValueIsGiven()
        {
            //Given
            string romanNum = "-V";
            //When
            Action action = () => RomanConverter.ConvertRoman(romanNum);

            //Then
            action.Should().Throw <ApplicationException>().WithMessage("Negative Values Are Invalid");
        }
Exemple #5
0
        public void Should_ThrowException_WhenInputIsNull()
        {
            //Given
            string romanNum = null;
            //When
            Action action = () => RomanConverter.ConvertRoman(romanNum);

            //Then
            action.Should().Throw <NullReferenceException>();
        }
Exemple #6
0
        public void Should_ThrowError_WhenNumberExceedsMaxValue()
        {
            //Given
            string romanNum = "MMMMMMMMMMM";
            //When
            Action action = () => RomanConverter.ConvertRoman(romanNum);

            //Then
            action.Should().Throw <ApplicationException>().WithMessage("Number exceeds max value of 3999");
        }
Exemple #7
0
        public void Should_ReturnSumOfNumerals()
        {
            //Given
            string romanNum = "XVI";
            //When
            int integerNum = RomanConverter.ConvertRoman(romanNum);

            //Then
            integerNum.Should().Be(16);
        }
Exemple #8
0
        public void Should_returnDecimalInt()
        {
            //Given
            string romanNum = "X";
            //When
            int integerNum = RomanConverter.ConvertRoman(romanNum);

            //Then
            integerNum.Should().Be(10);
        }
Exemple #9
0
        public void Should_ReturnZero_IfParameterIsEmpty()
        {
            //Given
            string romanNum = "";
            //When
            int integerNum = RomanConverter.ConvertRoman(romanNum);

            //Then
            integerNum.Should().Be(0);
        }
Exemple #10
0
        public void Complex_Roman_Returns_Number()
        {
            //arrage
            RomanConverter romanConverter = new RomanConverter();

            //act
            int actual = romanConverter.ConvertRoman("DCXXIV");

            //assert
            Assert.Equal(624, actual);
        }
Exemple #11
0
        public void Simple_Roman_Returns_OneDigit_Number(int expected, string value)
        {
            //arrage
            RomanConverter romanConverter = new RomanConverter();

            //act
            int actual = romanConverter.ConvertRoman(value);

            //assert
            Assert.Equal(expected, actual);
        }
Exemple #12
0
        public void Roman_IsNullOrEmpty_Throws_ArgumentNullException(string value)
        {
            //arrage
            RomanConverter romanConverter = new RomanConverter();

            //act
            Action actual = () => romanConverter.ConvertRoman(value);

            //assert
            Assert.Throws <ArgumentNullException>(actual);
        }