public async Task ValidateDateIsCoerced()
        {
            TestCleanupWrapper cleanup;

            Grid rootPanel = null;
            CalendarDatePickerHelper helper = new CalendarDatePickerHelper();
            await helper.PrepareLoadedEvent();

            Windows.UI.Xaml.Controls.CalendarDatePicker cp = await helper.GetCalendarDatePicker();

            rootPanel = await CreateTestResources();

            // load into visual tree
            await RunOnUIThread(() =>
            {
                rootPanel.Children.Append(cp);
                cp.MinDate = ConvertToDateTime(1, 2000, 1, 1);
                cp.MaxDate = ConvertToDateTime(1, 2002, 1, 1);
                cp.Date    = ConvertToDateTime(1, 2001, 1, 1);
            });

            helper.WaitForLoaded();

            await TestServices.WindowHelper.WaitForIdle();

            await RunOnUIThread(() =>
            {
                VERIFY_IS_NOT_NULL(cp.Date);
                VERIFY_DATES_ARE_EQUAL(cp.Date.Value.UniversalTime(), ConvertToDateTime(1, 2001, 1, 1).UniversalTime());

                // make date beyond the range.
                // it should be coerced to min/max
                cp.Date = ConvertToDateTime(1, 2010, 1, 1);
                cp.UpdateLayout();
                VERIFY_IS_NOT_NULL(cp.Date);
                VERIFY_DATES_ARE_EQUAL(cp.Date.Value.UniversalTime(), cp.MaxDate.UniversalTime());

                cp.Date = ConvertToDateTime(1, 1999, 1, 1);
                cp.UpdateLayout();
                VERIFY_IS_NOT_NULL(cp.Date);
                VERIFY_DATES_ARE_EQUAL(cp.Date.Value.UniversalTime(), cp.MinDate.UniversalTime());
            });
        }
        public async Task SettingCalendarIdentifierChangesDateFormat()
        {
            TestCleanupWrapper cleanup;

            Grid      rootPanel = null;
            TextBlock dateText  = null;

            CalendarDatePickerHelper helper = new CalendarDatePickerHelper();
            await helper.PrepareLoadedEvent();

            Windows.UI.Xaml.Controls.CalendarDatePicker cp = await helper.GetCalendarDatePicker();

            rootPanel = await CreateTestResources();

            // load into visual tree
            await RunOnUIThread(() =>
            {
                rootPanel.Children.Append(cp);
                cp.MinDate = ConvertToDateTime(1, 2000, 1, 1);
                cp.MaxDate = ConvertToDateTime(1, 2002, 1, 1);
                cp.Date    = ConvertToDateTime(1, 2001, 1, 1);
            });

            helper.WaitForLoaded();

            await TestServices.WindowHelper.WaitForIdle();

            await RunOnUIThread(() =>
            {
                dateText = TextBlock(helper.GetTemplateChild("DateText"));
                VERIFY_IS_NOT_NULL(dateText);
            });

            await TestServices.WindowHelper.WaitForIdle();

            await RunOnUIThread(() =>
            {
                cp.DateFormat = "{dayofweek.full}, {month.full} {day.integer}, {year.full}";                 // equivalent to "longdate"
                cp.UpdateLayout();

                cp.CalendarIdentifier = Windows.Globalization.CalendarIdentifiers.Taiwan;

                LOG_OUTPUT("actual text: %s.", dateText.Text);
                VERIFY_ARE_EQUAL("Monday, January 1, 90", dateText.Text);
            });
        }