Closed shargon closed 1 month ago
Why you dont you tap into their framework? Yes, I know its
xunit
, but will still work.
Could you show me an example, I can migrate it easily to xunit.
https://github.com/neo-project/neo-express/tree/master/src/collector
Example
var logger = new Moq.Mock<ILogger>();
var collector = new CodeCoverageCollector(logger.Object);
collector.TrackTestContract("contract", "registrar.nefdbgnfo");
collector.LoadTestOutput("run1");
var coverage = collector.CollectCoverage().ToList();
var format = new CoberturaFormat();
Dictionary<string, string> outputMap = new();
format.WriteReport(coverage, writeAttachment);
void writeAttachment(string filename, Action<Stream> writeAttachment)
{
using var stream = new MemoryStream();
var text = Encoding.UTF8.GetString(stream.ToArray());
outputMap.Add(filename, text);
}
There are some test contracts that are not checked (or covered) like: