I'm using Selenium OpenQA in C# and trying to write an assert that will compare two strings and assert True if some of the text in the first string matches the partial text in the second string.
string ActualValue = driver.FindElement(By.CssSelector("div.Toastify__toast.Toastify__toast--error")).Text;
Assert.IsTrue(ActualValue.Contains("There was an error validating your API key. Please contact Support and provide us with your public facing IP address:"));
My 'ActualValue' string is picking up this text string and I need to match it to the string above (minus the IP address): "There was an error validating your API key. Please contact Support and provide us with your public facing IP address:22.12.23.14"
This test fails to evaluate to True.
string ActualValue = driver.FindElement(By.CssSelector("div.Toastify__toast.Toastify__toast--error")).Text;
Assert.IsTrue(ActualValue.Contains("There was an error validating your API key. Please contact Support and provide us with your public facing IP address:"));
Expected results - since the first string is contained in the second string, I expect the assert.is true == true Actual results -I get the message that the assert failed 'Message: Expected: True But was: False'