static void Assert(string accessPath, FormsMonthCalendar monthCalendar) { CaptureAdaptor.AddUsing(typeof(DateTime).Namespace); var value = monthCalendar.SelectedDay; CaptureAdaptor.AddCode($"{accessPath}.SelectedDay.Date.Is(new DateTime({value.Year}, {value.Month}, {value.Day}));"); }
void Assert(string accessPath, WPFDatePicker datePicker) { CaptureAdaptor.AddUsing(typeof(DateTime).Namespace); if (datePicker.SelectedDate.HasValue) { var value = datePicker.SelectedDate.Value; CaptureAdaptor.AddCode($"{accessPath}.SelectedDate.Is(new DateTime({value.Year}, {value.Month}, {value.Day}));"); } else { CaptureAdaptor.AddCode($"{accessPath}.SelectedDate.IsNull();"); } }
public Dictionary <string, Action> GetAction(string accessPath, object driver) { var dic = new Dictionary <string, Action>(); if (driver is IWebDriver web) { dic["Url"] = () => { CaptureAdaptor.AddCode(accessPath + ".Url = " + ToLiteral(web.Url) + ";"); }; dic["Alert - Accept"] = () => { CaptureAdaptor.AddCode(accessPath + ".WaitForAlert().Accept();"); CaptureAdaptor.AddUsing("Selenium.StandardControls"); }; dic["Alert - Dismiss"] = () => { CaptureAdaptor.AddCode(accessPath + ".WaitForAlert().Dismiss();"); CaptureAdaptor.AddUsing("Selenium.StandardControls"); }; } else { if (driver is AnchorDriver anchor) { dic["Assert"] = () => Assert(accessPath, anchor); } else if (driver is DateDriver date) { dic["Assert"] = () => Assert(accessPath, date); } else if (driver is DropDownListDriver dropdown) { dic["Assert"] = () => Assert(accessPath, dropdown); } else if (driver is LabelDriver label) { dic["Assert"] = () => Assert(accessPath, label); } else if (driver is RadioButtonDriver radio) { dic["Assert"] = () => Assert(accessPath, radio); } else if (driver is CheckBoxDriver check) { dic["Assert"] = () => Assert(accessPath, check); } else if (driver is TextAreaDriver textArea) { dic["Assert"] = () => Assert(accessPath, textArea); } else if (driver is TextBoxDriver textBox) { dic["Assert"] = () => Assert(accessPath, textBox); } else if (driver is IWebElement element) { dic["Assert"] = () => Assert(accessPath, element); } else if (IsItemsControl(driver)) { dic["Assert"] = () => AssertItemsControl(accessPath, driver); } else { dic["Assert All"] = () => AssertAll(accessPath, driver); } } return(dic); }
static void Assert(string accessPath, FormsCheckBox checkBox) { CaptureAdaptor.AddUsing(typeof(CheckState).Namespace); CaptureAdaptor.AddCode($"{accessPath}.CheckState.Is(CheckState.{checkBox.CheckState});"); }