Hi Guys
Hopefully someone can clear something up for me.
I am trying to to a simple Assertion to confirm that two strings are the same.
I have a field on a form, I edit the form > enter a value > extract the text as a variable > save the changes
Then on the main form the updated value should be displayed > I used dev tools to get the ID of the field as its a Kentico control > then in code I want to assert that the two values are the same. if they are the same then the test is valid otherwise it should fail.
From my understanding, Assert.AreSame checks if the two objects are the same object and Assert.Equals just checks if the strings or whatever are the same. Am I right?
See the code below:
Assert.AreSame(town, Find.ById("ctl00_ctl00_cphMain_cphMain_TownLabel").TextContent);
or
Assert.Equals(town, Find.ById("ctl00_ctl00_cphMain_cphMain_TownLabel").TextContent);
Does anyone have any ideas why my Equals assertion passes if it has two different values and if they are the same.
Any help would be much appreciated
Thanks
Michelle
Hopefully someone can clear something up for me.
I am trying to to a simple Assertion to confirm that two strings are the same.
I have a field on a form, I edit the form > enter a value > extract the text as a variable > save the changes
Then on the main form the updated value should be displayed > I used dev tools to get the ID of the field as its a Kentico control > then in code I want to assert that the two values are the same. if they are the same then the test is valid otherwise it should fail.
From my understanding, Assert.AreSame checks if the two objects are the same object and Assert.Equals just checks if the strings or whatever are the same. Am I right?
See the code below:
Assert.AreSame(town, Find.ById("ctl00_ctl00_cphMain_cphMain_TownLabel").TextContent);
or
Assert.Equals(town, Find.ById("ctl00_ctl00_cphMain_cphMain_TownLabel").TextContent);
Does anyone have any ideas why my Equals assertion passes if it has two different values and if they are the same.
Any help would be much appreciated
Thanks
Michelle