AcornPublishing_essential-csharp-7e/EssentialCSharp-8.0/src/Chapter05.Tests/Listing05.24.FinallyWithoutCatch.Tests.cs
using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace AddisonWesley.Michaelis.EssentialCSharp.Chapter05.Listing05_24.Tests
{
    [TestClass]
    public class ExceptionHandlingTests
    {
        [TestMethod]
        public void Main_InputInvalidAge_ExceptionCatching()
        {
            bool flag = false;
            string view =
@"<<Inigo
xyz
>>";

            try
            {
                IntelliTect.TestTools.Console.ConsoleAssert.Expect(view,
                () =>
                {
                    ExceptionHandling.Main();
                });
            }
            catch (FormatException)
            {
                flag = true;
            }

            Assert.IsTrue(flag);
        }
    }
}