KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
From Microsoft's documentation, partially covered code is "...where some of the code blocks within the line were not executed." I'm pretty stumped on this one (simplified for brevity): Given this method: public List<string> CodeUnderTest() { var collection = new List<string> { "test1", "test2", "test3" }; return collection.Where(x => x.StartsWith("t") && x == "test2").ToList(); } And this test: [TestMethod] public void Test() { var result = new Class1().CodeUnderTest(); CollectionAssert.Contains(result, "test2"); } Code coverage results shows that the expression x.StartsWith("t") && x == "test2 is only partially covered. I'm not sure how that's possible unless the compiler or CLR has some sort of eager condition matching stuff, but maybe I just need to have it explained.
Tags (comma-separated)
Save Edits
Cancel