public void LookUp_WithExistentParagraphName_ShouldReturnMatchingObject() { string searchPattern = "JOHNDOE"; string searchContent = "Content"; Mock <IMsBuildElementHelpParagraph> searchedParagraph = new Mock <IMsBuildElementHelpParagraph>(); searchedParagraph.Setup(p => p.Name).Returns(searchPattern); searchedParagraph.Setup(p => p.Content).Returns(searchContent); Mock <IMsBuildElementHelpParagraph> paragraphTwo = new Mock <IMsBuildElementHelpParagraph>(); paragraphTwo.Setup(p => p.Name).Returns("NOTRELEVANT"); IList <IMsBuildElementHelpParagraph> paragraphsList = new List <IMsBuildElementHelpParagraph>() { searchedParagraph.Object, paragraphTwo.Object }; MsBuildElementHelp sutHelp = new MsBuildElementHelp(paragraphsList); Assert.AreEqual(searchedParagraph.Object, sutHelp.LookUp(searchPattern).First()); }
LookUp_WithExistentParagraphNameDifferentCaseButStringComparisionIgnoreCase_ShouldReturnMatchingObject() { string searchPattern = "JOHNDOE"; string searchContent = "Content"; Mock <IMsBuildElementHelpParagraph> searchedParagraph = new Mock <IMsBuildElementHelpParagraph>(); searchedParagraph.Setup(p => p.Name).Returns(searchPattern); searchedParagraph.Setup(p => p.Content).Returns(searchContent); Mock <IMsBuildElementHelpParagraph> paragraphTwo = new Mock <IMsBuildElementHelpParagraph>(); paragraphTwo.Setup(p => p.Name).Returns("NOTRELEVANT"); IList <IMsBuildElementHelpParagraph> paragraphsList = new List <IMsBuildElementHelpParagraph>() { searchedParagraph.Object, paragraphTwo.Object }; MsBuildElementHelp sutHelp = new MsBuildElementHelp(paragraphsList); var lookedUpParagraph = sutHelp.LookUp("JohnDoe", StringComparison.OrdinalIgnoreCase); Assert.AreEqual(searchedParagraph.Object, lookedUpParagraph.First()); }
public void LookUp_WithExistentParagraphNameButDifferentCase_ShouldReturnNoMatchingObjects() { string searchPattern = "JOHNDOE"; string searchContent = "Content"; Mock <IMsBuildElementHelpParagraph> searchedParagraph = new Mock <IMsBuildElementHelpParagraph>(); searchedParagraph.Setup(p => p.Name).Returns(searchPattern); searchedParagraph.Setup(p => p.Content).Returns(searchContent); Mock <IMsBuildElementHelpParagraph> paragraphTwo = new Mock <IMsBuildElementHelpParagraph>(); paragraphTwo.Setup(p => p.Name).Returns("NOTRELEVANT"); IList <IMsBuildElementHelpParagraph> paragraphsList = new List <IMsBuildElementHelpParagraph>() { searchedParagraph.Object, paragraphTwo.Object }; MsBuildElementHelp sutHelp = new MsBuildElementHelp(paragraphsList); var lookedUpParagraph = sutHelp.LookUp("JohnDoe"); Assert.AreEqual(0, lookedUpParagraph.Count); }