private static void RunArguments(Arguments arguments) { JSONCoverage jsonCoverage = CoberturaConverter.ConvertFromCobertura(arguments.CoverageFile, arguments.RepositoryRoot); var client = new Client(arguments.BitbucketURL, arguments.Username, arguments.Password); var responseMessage = client.PostCoverageAsync(arguments.CommidID, jsonCoverage.ConvertToJson()); Console.WriteLine(responseMessage.Result.ToString()); }
public void CanConvertFromOpenCover(TestFile openCoverTestFile) { using (var xmlStream = TestFilesFactory.GetTestFileStream(openCoverTestFile)) { var conversionResult = CoberturaConverter.ConvertOpenCoverToCobertura(xmlStream); Assert.NotNull(xmlStream); Assert.True(xmlStream.Length > 0); // Checking if it's valid XML output, // otherwise the Load() method should throw XDocument.Load(conversionResult); } }
public void UseCoveredStatementsForLinesCoveredInCobertura() { using (var xmlStream = TestFilesFactory.GetTestFileStream(DotCoverConverter.Core.Tests.TestFile.DanglCommonDotCover)) { using (var convertedCoberturaStream = CoberturaConverter.ConvertDotCoverToCobertura(xmlStream)) { var coberturaXml = XDocument.Load(convertedCoberturaStream); var actualLinesCovered = coberturaXml.Descendants() .Where(d => d.Name.LocalName == "coverage") .Select(d => d.Attribute("lines-covered")) .Select(a => a.Value) .Single(); var expected = "492"; // 500 TotalStatements in dotCover report Assert.Equal(expected, actualLinesCovered); } } }