public void CompareValues() { var numbers = new Dictionary <int, string> { [1] = "I", [5] = "V", [10] = "X", [20] = "XX", [3999] = "MMMCMXCIX" }; // Arrange var objController = new RomanNumeralController(); foreach (var objKeyPair in numbers) { // Act var result = objController.GetRomanNumeral(objKeyPair.Key) as OkNegotiatedContentResult <RomanNumeral>; // Assert Assert.IsNotNull(result); Assert.IsNotNull(result.Content.numeral); Assert.AreEqual(result.Content.numeral, objKeyPair.Value); } }
public void PassIfMin() { // Arrange var objController = new RomanNumeralController(); // Act var result = objController.GetRomanNumeral(_min) as OkNegotiatedContentResult <RomanNumeral>; // Assert Assert.IsNotNull(result); Assert.IsNotNull(result.Content.numeral, result.Content.errorMessage); Console.WriteLine($"{result.Content.numeral} = {result.Content.number}"); }
public void FailIfNumberIsAboveRange() { // Arrange var objController = new RomanNumeralController(); // Act var result = objController.GetRomanNumeral(_max + 1) as OkNegotiatedContentResult <RomanNumeral>; // Assert Assert.IsNotNull(result); Assert.IsNull(result.Content.numeral); Console.WriteLine(result.Content.errorMessage); }
public void RunFullRange() { // Arrange var objController = new RomanNumeralController(); for (var i = _min; i <= _max; i++) { // Act var result = objController.GetRomanNumeral(i) as OkNegotiatedContentResult <RomanNumeral>; // Assert Assert.IsNotNull(result); Assert.IsNotNull(result.Content.numeral, result.Content.errorMessage); Console.WriteLine($"{result.Content.numeral} = {result.Content.number}"); } }