From the Microsoft documentation, the partially covered code "... where some of the code blocks in the line did not execute." I'm pretty dumb on this (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"); }
The code coverage results show that the expression x.StartsWith("t") && x == "test2 is only partially covered. I'm not sure how possible it is if the compiler or the CLR does not have some element that satisfies the requirements, but maybe I just need to explain it.
c # unit-testing code-coverage mstest
lukiffer
source share