Partial coverage of a return statement in C++/CLI
- by brickner
I have C++/CLI code and I'm using Visual Studio 2008 Team Suite Code Coverage.
The code header:
// Library.h
#pragma once
#include <string>
using namespace System;
namespace Library
{
public ref class MyClass
{
public:
static void MyFoo();
static std::string Foo();
};
}
The code implementation:
#include "Library.h"
using namespace Library;
using namespace System;
void MyClass::MyFoo()
{
Foo();
}
std::string MyClass::Foo()
{
return std::string();
}
I have a C# unit test, that calls MyClass.MyFoo():
[TestMethod]
public void TestMethod1()
{
Library.MyClass.MyFoo();
}
For some reason, I don't get a full code coverage for MyClass. The Foo() method has 3 uncovered blocks and 5 covered blocks. The closing curly brackets (}) are marked in orange - partially covered. I have no idea why is it partially covered instead of fully covered, and this is my question.