How to set up an assertion to verify value of an element for C# - XUnit?

How should I set up an assertion to verify value of an element if I’m using C# - XUnit?

Hi Helen,

To do this, please refer and add the following codes below:

 Assert.Equal("Sample page - lambdatest.com", driver.Title);
        
            IWebElement firstCheckBox = driver.FindElement(By.Name("li1"));
            firstCheckBox.Click();
 

            IWebElement secondCheckBox = driver.FindElement(By.Name("li2"));
            secondCheckBox.Click();
 
           
            IWebElement textfield = driver.FindElement(By.Id("sampletodotext"));
            textfield.SendKeys(itemName);
 
       
            IWebElement addButton = driver.FindElement(By.Id("addbutton"));
            addButton.Click();
 

            IWebElement itemtext = driver.FindElement(By.XPath("/html/body/div/div/div/ul/li[6]/span"));
            String getText = itemtext.Text;
            Assert.True(itemName.Contains(getText));