static void Main(string[] args) { string jsonString = string.Empty; if (GetJsonString.ReadFromFile(@".\..\..\JSON.txt", out jsonString) == false) { return; } JsonModel model = JsonToModel.StringToModel(jsonString); try { ResultOutput.Print(model.arrayOne, "ArrayOne"); ResultOutput.Print(model.arrayTwo, "ArrayTwo"); var Info = new InfoStr(); ResultOutput.Print(TestRequest.GetUniqueValues(model.arrayOne, model.arrayTwo), Info.uniqueStr); ResultOutput.Print(TestRequest.GetOddNumbers(model.arrayOne, model.arrayTwo), Info.oddNbrStr); ResultOutput.Print(TestRequest.GetEvenNbrSum(model.arrayOne, model.arrayTwo), Info.sumStr); } catch (ArgumentNullException) { Console.WriteLine("EmptyArray"); } catch (OverflowException) { Console.WriteLine("Overflow!"); } Console.ReadLine(); }
public void GetEvenNbrSumFalse() { var expected = 5; var result = TestRequest.GetEvenNbrSum(new int[] { 2, 4 }, new int[] { 8, 9, 3 }); Assert.AreNotEqual(expected, result); }
public void GetEvenNbrSumOverFlow() { try { TestRequest.GetEvenNbrSum(new int[] { 2, 2147483646 }, new int[] { 1, 4, 8, 9 }); } catch (OverflowException) { Assert.IsTrue(true); } catch (Exception) { Assert.Fail(); } }
public void GetEvenNbrSumNullReference() { try { TestRequest.GetEvenNbrSum(null, null); } catch (ArgumentNullException) { Assert.IsTrue(true); } catch (Exception) { Assert.Fail(); } }