public void toRomanToIntSend_MMCMXXXVII_Expected_2937()
        {
            const int expected = 2937;
            var       actual   = RomanConverter.RomanToInt("MMCMXXXVII");

            Assert.AreEqual(expected, actual);
        }
        public void toRomanToIntSend_MXII_Expected_1012()
        {
            const int expected = 1012;
            var       actual   = RomanConverter.RomanToInt("MXII");

            Assert.AreEqual(expected, actual);
        }
        public void toRomanToIntSend_LIX_Expected_59()
        {
            const int expected = 59;
            var       actual   = RomanConverter.RomanToInt("LIX");

            Assert.AreEqual(expected, actual);
        }
        public void toRomanTonInt_send_MMMCMXCIX_expected_max_3999()
        {
            const int expected = 3999;
            var       actual   = RomanConverter.RomanToInt("MMMCMXCIX");

            Assert.AreEqual(expected, actual);
        }
Beispiel #5
0
        public void StackOverflow()
        {
            //arrange
            string str = RomanConverter.input = "XXXMMMCXIT";

            //assert
            Assert.ThrowsException <StackOverflowException>(() => RomanConverter.RomanToInt(str));
        }
Beispiel #6
0
        public void ArgumentOutOfRange()
        {
            //arrange
            string str = RomanConverter.input = "MMMM";

            //assert
            Assert.ThrowsException <ArgumentOutOfRangeException>(() => RomanConverter.RomanToInt(str));
        }
Beispiel #7
0
        public void InputMMCMXCIX()
        {
            // arrange
            string res = "MMCMXCIX";
            // act
            int actual = RomanConverter.RomanToInt(res);

            // assert
            Assert.AreEqual(2999, actual);
        }
        public void convert_a_roman_numeral_to_an_integer(int expectedResult, string input)
        {
            //Arrange
            var converter = new RomanConverter();
            //Act
            var result = converter.RomanToInt(input);

            //Assert
            Assert.Equal(expectedResult, result);
        }
Beispiel #9
0
 private void RomanToNumberConvertButton_Click(object sender, EventArgs e)
 {
     try
     {
         RomanToNumberOutputLabel.Text = RomanConverter.RomanToInt(RomanToNumberInputTextBox.Text).ToString(CultureInfo.InvariantCulture);
     }
     catch (Exception)
     {
         MessageBox.Show("Invalid input.");
     }
 }