Below is the assertions for my Test How i can combine all the assertions in one line of code
public void ThenICanSeeTheFunctionlitiesForNONtransitionUserAsClnician()
{
Assert.IsTrue(ObjectRepository.phPage.GetMenuList().Contains("Show menu"));
Assert.IsTrue(ObjectRepository.phPage.GetMenuList().Contains("Patient Summary"));
Assert.IsTrue(ObjectRepository.phPage.GetMenuList().Contains("Patient Encounter"));
}
Assumptions
ObjectRepository.phPage.GetMenuList()
returns IEnumerable<string>
First we need to create a collection of items which we expect to have in the "MenuList" and what we actually have
var expectedItems = new List<string> { "Show menu", "Patient Summary", "Patient Encounter" };
var actualItems = ObjectRepository.phPage.GetMenuList();
Now you have two options based on what you need:
1. You want to check if the "MenuList" contains those 3 items (but not strictly only those)
CollectionAssert.IsSubsetOf(expectedItems, actualItems);
2. You want to check if the "MenuList" contains only those 3 items (nothing else)
CollectionAssert.AreEquivalent(expectedItems, actualItems);