unit testing - Failing in Code coverage Test with a simple class constructor -
i have class:
public class sourceserverprovider : isourceserverprovider { private readonly isourceserver _sourceserver; public sourceserverprovider() :this(new sourceserver()) { } public sourceserverprovider(isourceserver sourceserver) { _sourceserver = sourceserver; } }
ms code coverage test complaints block:
public sourceserverprovider() :this(new sourceserver()) { }
i don't know how write unit test above block. please advise..
i tested followig code:
public class sourceserverprovider : isourceserverprovider { private readonly isourceserver _sourceserver; public sourceserverprovider() : this(new sourceserver()) { } public sourceserverprovider(isourceserver sourceserver) { _sourceserver = sourceserver; } } public interface isourceserver { } public class sourceserver : isourceserver { } public interface isourceserverprovider { }
and wrote test
public class class1 { [test] public void test() { var = new sourceserverprovider(); } }
code coverage says covered:
so please add result getting or create asimple test call default ctor
Comments
Post a Comment