/// <summary>
        /// To assign private readonly property
        /// </summary>
        public RomanToIntConverterTests()
        {
            _romanToIntConverter = new RomanToIntConverter();
            _validStringsList    = new List <string>
            {
                "I", "V", "X", "L", "C", "D", "M",
                "II", "VV", "XX", "LL", "CC", "DD", "MM",
                "III", "VVV", "XXX", "LLL", "CCC", "DDD", "MMM",
                "IV", "IVI", "IX", "IXIII", "VII", "XIII", "IXVIV",
                "XL", "XLX", "XC", "XCXXX", "CXX", "LXXX", "CCCXCXL",
                "CD", "CDC", "CM", "CMCCC", "DCC", "MCCC", "MDCLXVI",
                "MMMCMDDDCDCCCXCLLLXLXXXIXVVVIVIII"
            };

            _inValidStringsList = new List <string>
            {
                "", "A", "Vijay", "VX", "IVXLCDM",
                "MMMCMDDDCDCCCXCLLLXLXXXIXVVVIVIIII"
            };

            _romanExpectedInt = new Dictionary <string, int>
            {
                { "MMMCMDDDCDCCCXCLLLXLXXXIXVVVIVIII", 6441 },
                { "CCCXCXL", 430 },
                { "MDCLXVI", 1666 },
                { "IXVIV", 18 }
            };
        }
Пример #2
0
 /// <summary>
 /// Constructor to assign private variables
 /// </summary>
 public CommunicationProcessorTests()
 {
     _fileReader             = new MockFileReader();
     _romanToIntConverter    = new RomanToIntConverter();
     _inputParser            = new InputParser(_romanToIntConverter);
     _answerGenerator        = new AnswerGenerator(_romanToIntConverter);
     _communicationProcessor = new CommunicationProcessor(_fileReader, _inputParser, _answerGenerator);
 }
 /// <summary>
 /// Method to initialize the private variables.
 /// </summary>
 /// <param name="filePath">Source File Path.</param>
 private static void GeneratePreRecs(string filePath)
 {
     _fileReader             = new FileReader(filePath);
     _romanToIntConverter    = new RomanToIntConverter();
     _inputParser            = new InputParser(_romanToIntConverter);
     _answerGenerator        = new AnswerGenerator(_romanToIntConverter);
     _communicationProcessor = new CommunicationProcessor(_fileReader, _inputParser, _answerGenerator);
 }
        /// <summary>
        /// Constructor to initialize private readonly properties.
        /// </summary>
        /// <param name="romanToIntConverter">Roman to Int Conversion.</param>
        public AnswerGenerator(IRomanToIntConverter romanToIntConverter)
        {
            if (romanToIntConverter == null)
            {
                throw new ArgumentNullException("romanToIntConverter");
            }

            _romanToIntConverter = romanToIntConverter;
        }
Пример #5
0
        /// <summary>
        /// Constructor to initialize private readonly properties.
        /// </summary>
        /// <param name="romanToIntConverter">Roman to Int Conversion.</param>
        public InputParser(IRomanToIntConverter romanToIntConverter)
        {
            if (romanToIntConverter == null)
            {
                throw new ArgumentNullException("romanToIntConverter");
            }

            _romanToIntConverter = romanToIntConverter;
        }
Пример #6
0
 /// <summary>
 /// To assign private readonly property
 /// </summary>
 public InputParserTests()
 {
     _romanToIntConverter = new RomanToIntConverter();
     _inputParser         = new InputParser(_romanToIntConverter);
 }
Пример #7
0
 /// <summary>
 /// To assign private readonly property
 /// </summary>
 public AnswerGeneratorTests()
 {
     _romanToIntConverter = new RomanToIntConverter();
     _answerGenerator     = new AnswerGenerator(_romanToIntConverter);
 }