static void Main(string[] args) { Console.WriteLine("Please enter the \n 1.The start number \n 2.The final one"); var inputStartNumber = CheckConvertToDouble(Console.ReadLine()); var inputLastNumber = CheckConvertToDouble(Console.ReadLine()); Console.WriteLine("Please enter the prime numbers \n 1. First prime number \n 2. Second prime number "); var firstPrime = PrimeNumberValidation(Console.ReadLine()); var secondPrime = PrimeNumberValidation(Console.ReadLine()); Console.WriteLine("Please enter the definition for special numbers \n 1. For the first value \n 2. For the second value "); string firstDefinition = Console.ReadLine(); string secondDefinition = Console.ReadLine(); Console.WriteLine("______________________________________________________"); var fizzBuzz = new FizzBuzzModel() { startNumber = inputStartNumber, lastNumber = inputLastNumber, firstPrime = firstPrime, secondPrime = secondPrime, firstDefinition = firstDefinition, secondDefinition = secondDefinition }; FizzBuzzLib.FizzBuzzLogic(fizzBuzz); Console.ReadKey(); }
/// <summary> /// This method requires question number as an argument. Question configuration is defined in the App.Config file ///Question1, Question3, Question4, Question5, Question6 /// </summary> /// <param name="args"></param> static void Main(string[] args) { String question = ""; if (args.Length > 0) { question = args[0]; } string[] strValue = ConfigurationManager.AppSettings[question.ToLower()].Split(','); FizzBuzzLib objFizBizzLib = new FizzBuzzLib(); string strOutput = ""; if (question.ToLower() == "Question6".ToLower()) { strOutput = objFizBizzLib.PrintDynamicText(strValue); } else { strOutput = objFizBizzLib.PrintText(strValue); } Console.WriteLine("Output for " + question + " is:\n" + strOutput); Console.ReadLine(); }
public void IsPositiveNumber_Minus5asInput_False() { int input = -5; var result = FizzBuzzLib.IsPositiveNumber(input); Assert.IsFalse(result); }
public void NotNullValidation_NullInput_False() { string input = null; var result = FizzBuzzLib.NotNullValidation(input); Assert.IsFalse(result); }
public void NumberValidation_MMMasInput_False() { string input = "MMM"; var result = FizzBuzzLib.NumberValidation(input); Assert.IsFalse(result); }
public void NotNullValidation_WhiteSpaceasInput_False() { string input = " "; var result = FizzBuzzLib.NotNullValidation(input); Assert.IsFalse(result); }
public void IsPrimeNumberChecker_WhiteSpaceasPrimeNumber_False() { string input = " "; var result = FizzBuzzLib.IsPrimeNumberChecker(input); Assert.IsFalse(result); }
public void IsPrimeNumberChecker_3asPrimeNumber_True() { string input = "3"; var result = FizzBuzzLib.IsPrimeNumberChecker(input); Assert.IsTrue(result); }
public void IsPositiveNumber_5asInput_True() { int input = 5; var result = FizzBuzzLib.IsPositiveNumber(input); Assert.IsTrue(result); }
public void GenerateTest_Abnormal(int val) { var fb = new FizzBuzzLib(); Assert.Throws <ArgumentOutOfRangeException>(() => { fb.Generate(val); }); }
public void ConvertToFizzBuzzTest_Abnromal(int val) { var fb = new FizzBuzzLib(); Assert.Throws <ArgumentOutOfRangeException>(() => { fb.ConvertToFizzBuzz(val); }); }
public void NumberValidation_5asInput_True() { string input = "5"; FizzBuzzLib.Value = 5; var result = FizzBuzzLib.NumberValidation(input); Assert.IsTrue(result); }
public void ParseToDouble_5asInput_5() { string input = "5"; double expected = 5; var result = FizzBuzzLib.ParseToDouble(input); Assert.AreEqual(expected, actual: result); }
public static double CheckConvertToDouble(string input) { while (FizzBuzzLib.NumberValidation(input).Equals(false)) { var message = FizzBuzzLib.Message; Console.WriteLine(message); input = Console.ReadLine(); } double value = FizzBuzzLib.ParseToDouble(input); return(value); }
public void StartLastNumberChecker_100asStartNumber1asLastNumber_StartNumber1LastNumber100() { double startNumber = 100; double finalNumber = 1; double expectedStart = 1; double expectedFinal = 100; FizzBuzzLib.StartLastNumberChecker(ref startNumber, ref finalNumber); Assert.AreEqual(startNumber, expectedStart); Assert.AreEqual(finalNumber, expectedFinal); }
public void Count_ShouldReturn7_WhenInputIs7() { FizzBuzzLib FizzBuzz = new FizzBuzzLib(); Assert.AreEqual("7", FizzBuzz.Count(7)); }
public void Count_ShouldReturn2_WhenInputIs2() { FizzBuzzLib FizzBuzz = new FizzBuzzLib(); Assert.AreEqual("2", FizzBuzz.Count(2)); }
public void GenerateTest_Normal(int val, string expected) { var fb = new FizzBuzzLib(); Assert.Equal(expected, fb.Generate(val)); }
public string FizzBuzzLib_Generate() { var fb = new FizzBuzzLib(); return(fb.Generate(Val)); }
public void Count_ShouldReturnFizzBuzz_WhenInputIs30() { FizzBuzzLib FizzBuzz = new FizzBuzzLib(); Assert.AreEqual("FizzBuzz", FizzBuzz.Count(30)); }
public void ConvertToFizzBuzzTest_Normal(int val, string expected) { var fb = new FizzBuzzLib(); Assert.Equal(expected, fb.ConvertToFizzBuzz(val)); }
public void Count_ShouldReturn1_WhenInputIs1() { FizzBuzzLib FizzBuzz = new FizzBuzzLib(); Assert.AreEqual("1", FizzBuzz.Count(1)); }
public void BeforeAll() { var fizzBuzzLib = new FizzBuzzLib(); }