我需要从应用程序日历中选择过去的工作日(任何上一个工作日): 但Coded UI测试方法并没有正确地采用工作日。任何人都可以看到错误:
[CodedUITest]
public class CodedUITest1
{
public CodedUITest1()
{
}
private DayOfWeek[] AllowedDays
= { DayOfWeek.Monday, DayOfWeek.Tuesday, DayOfWeek.Wednesday,
DayOfWeek.Thursday, DayOfWeek.Friday, };
public void CodedUITestMethod1() {
// this.UIMap.SelectApptdate(DateTime.Now.AddDays(-3));
this.UIMap.SelectApptdate(
DateTime.Now.AddDays(-2).Day.Equals(DayOfWeek.Saturday)
? DateTime.Now.AddDays(-4)
: DateTime.Now.AddDays(-2).Day.Equals(DayOfWeek.Sunday)
? DateTime.Now.AddDays(-3)
: DateTime.Now.AddDays(-4)
);
}
}
我还在UIMap.cs
文件中重载了该方法,如下所示:
public partial class UIMap
{
public void SelectApptDate(DateTime date)
{
SelectApptDateParams.UIUicReqApptDateDateTimePickerDateTimeAsString
= date.ToString("MM/dd/yyyy");
SelectApptDate();
}
}