static void Main(string[] args) { RomanNumeralGenerator generator = new RomanNumeralGenerator(); if (args.Length > 0) { Console.WriteLine(generator.generate(int.Parse(args[0]))); Console.ReadKey(); } }
public void TooLargeNumber2() { RomanNumeralGenerator testObject = new RomanNumeralGenerator(); var actual = testObject.Generate(999000); //Assert Exception }
public void NegativeNumber() { RomanNumeralGenerator testObject = new RomanNumeralGenerator(); var actual = testObject.Generate(-1); //Assert Exception }
public void Test_L() { int value = 50; string expected = "L"; RomanNumeralGenerator testObject = new RomanNumeralGenerator(); var actual = testObject.Generate(value); Assert.AreEqual(expected, actual); }
public void Should_Return_Correct_Numeral(string numeral, int number) { //Arrange var generator = new RomanNumeralGenerator(); //Act var result = generator.GetRomanNumeral(number); //Assert Assert.AreEqual(numeral, result); }
public void TestRange() { RomanNumeralGenerator testObject = new RomanNumeralGenerator(); foreach (var pair in testvalues) { var expected = pair.Value; var actual = testObject.Generate(pair.Key); Assert.AreEqual(expected, actual); } }
public void Should_Throw_Exception_When_Number_Is_Greater_Than_50() { var generator = new RomanNumeralGenerator(); try { //act var result = generator.GetRomanNumeral(51); } catch (Exception ex) { //Assert Assert.AreEqual("Must provide a positive number between 1 and 50", ex.Message); } }
public void Should_Throw_Exception_When_Number_Is_Negative() { //Arrange var generator = new RomanNumeralGenerator(); try { //act string result = generator.GetRomanNumeral(-1); } catch (Exception ex) { Assert.AreEqual("Must provide a positive number between 1 and 50", ex.Message); } }
static void Main(string[] args) { try { var parse = ParseArgs(args); if (parse.HasError) { Console.WriteLine($"Arguements are not valid: {parse.ExceptionMessage}"); return; } RomanNumeralGenerator generator = new RomanNumeralGenerator(); var inRomanNums = generator.Generate(parse.ParsedInt); Console.WriteLine($"{parse.ParsedInt} in Roman Numerals is {inRomanNums}"); } catch (Exception ex) { Console.WriteLine($"Error: {ex.Message}"); } }
public void WhenCalledWithAnInteger_ReturnRomanNumerals(int integer, string expectedResults) { Assert.That(RomanNumeralGenerator.GetNumeral(integer), Is.EqualTo(expectedResults)); }
public void ToRomanNumeralShould_ReturnEmptyString_WhenInput0() { var result = RomanNumeralGenerator.ToRomanNumeral(0); Assert.Equal("", result); }
public void ToRomanNumeralShould_ReturnX_WhenInput10() { var result = RomanNumeralGenerator.ToRomanNumeral(10); Assert.Equal("X", result); }
public void ToRomanNumeralShould_ReturnV_WhenInput5() { var result = RomanNumeralGenerator.ToRomanNumeral(5); Assert.Equal("V", result); }
public void ToRomanNumeralShould_ReturnCorrectValue_WhenInputSingleNumberInt(string expected, int input) { var result = RomanNumeralGenerator.ToRomanNumeral(input); Assert.Equal(expected, result); }