示例#1
0
        public void WpfDemoCheckCalendar()
        {
            Assert.IsTrue(_fixture.SelectItem("Caption:More Controls"), "Select 'More Controls' tab");
            Assert.AreEqual("", _fixture.ValueOfControl("ControlType:Calendar"), "Default value of Calendar1");
            var expectedDate = DateTime.Today;
            // select a different day in this month, so that we don't need to select a different month first
            var daysToAdd      = expectedDate.Day < 15 ? 10 : -10;
            var selectionValue = expectedDate.AddDays(daysToAdd).ToLongDateString();

            // this should be set using a selection
            Assert.IsTrue(_fixture.SetValueOfControlTo("id:Calendar1", selectionValue),
                          "Set value of Calendar1 to " + selectionValue);
            Assert.AreEqual(selectionValue, _fixture.ValueOfControl("id:Calendar1"), "New value of Calendar1");
        }