This is a migrated thread and some comments may be shown as answers.

[Solved] Verification from two sources

3 Answers 56 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Yuriy
Top achievements
Rank 1
Yuriy asked on 19 May 2015, 06:30 AM

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.

3 Answers, 1 is accepted

Sort by
0
Ivaylo
Telerik team
answered on 21 May 2015, 03:25 PM
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!
0
Yuriy
Top achievements
Rank 1
answered on 22 May 2015, 08:00 AM

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!

0
Ivaylo
Telerik team
answered on 25 May 2015, 12:26 PM
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!
Tags
General Discussions
Asked by
Yuriy
Top achievements
Rank 1
Answers by
Ivaylo
Telerik team
Yuriy
Top achievements
Rank 1
Share this question
or