Verification from two sources

4 posts, 0 answers
  1. Yuriy
    Yuriy avatar
    13 posts
    Member since:
    May 2015

    Posted 19 May 2015 Link to this post

    Hello, Telerik Team!

     

    I need your help.

     

    I have two fields - one with date "DatePickerText" (e.g. 18/05/2015) and second with time "TimePickerText" (e.g. 9:00 AM). Also I have third field which include date and time "PickupTimeSpan" (e.g. 5/19/2015 9:00 AM).

    I should verify that "PickupTimeSpan" = "DatePickerText" + "TimePickerText".

    I think I should do following steps:

    1. Extract "DatePickerText"

    2. Extract "TimePickerText"

    3. Create variable  which = "DatePickerText" + "TimePickerText" - coded step

    4. Compare "PickupTimeSpan" with variable. - maybe also coded step

     

    Unfortunately,  I don't know how can do steps 3 and 4.

  2. Ivaylo
    Admin
    Ivaylo avatar
    750 posts

    Posted 21 May 2015 Link to this post

    Hello Yuriy,

    Yes, you are right this can be done using coded steps only.

    One thing that comes to my mind is that you can convert the extracted data to stings and afterwards compare those strings. You can use this article as a starting point.

    Regards,
    Ivaylo
    Telerik
     
    The New Release of Telerik Test Studio Is Here! Download, install,
    and send us your feedback!
  3. Yuriy
    Yuriy avatar
    13 posts
    Member since:
    May 2015

    Posted 22 May 2015 in reply to Ivaylo Link to this post

    Hello, Ivaylo!

    Article was useful for me. I've written following code step:

    String dat = (string)(System.Convert.ChangeType(Data["DatePickerText"], typeof(string)));
    DateTime dt = Convert.ToDateTime(dat);
    dat = dt.ToShortDateString();

    String tm = (string)(System.Convert.ChangeType(Data["TimePickerText"], typeof(string)));
    DateTime dtim = Convert.ToDateTime(tm);
    tm = dtim.ToShortTimeString();

    String pickup = dat + " " + tm;

    Pages.CheckOut59.LblPickupTimeSpan.AssertContent().TextContent(ArtOfTest.Common.StringCompareType.Contains, pickup);

    It is worked.

    Thank you for your help!

  4. Ivaylo
    Admin
    Ivaylo avatar
    750 posts

    Posted 25 May 2015 Link to this post

    Hello Yuriy,

    You are most welcome.

    Thanks for sharing.

    Regards,
    Ivaylo
    Telerik
     
    The New Release of Telerik Test Studio Is Here! Download, install,
    and send us your feedback!
Back to Top