public void FormatPhoneTests(string @in, string @out, bool awaitException) { try { var res = FormattingHelper.FormatPhone(@in); Console.WriteLine(res); Assert.AreEqual(res, @out); } catch (Exception e) { Console.WriteLine(e.GetType().Name); if (awaitException) { Assert.That(e is PhoneValidationException); } else { throw; } } }