public void Gradle_SingleModule_EnableCodeCoverageForCoberturaTest() { SetupMocks(); LoadBuildFile(CodeCoverageTestConstants.BuildGradle); var enableCodeCoverage = new CodeCoverageEnablerForCoberturaGradle(); enableCodeCoverage.Initialize(_hc); var ccInputs = new Dictionary<string, string>(); ccInputs.Add("buildfile", _sampleBuildFilePath); ccInputs.Add("classfilesdirectories", _classDirectories); ccInputs.Add("classfilter", _classFilter); ccInputs.Add("summaryfile", _summaryFile); ccInputs.Add("reportdirectory", _reportDirectory); enableCodeCoverage.EnableCodeCoverage(_ec.Object, new CodeCoverageEnablerInputs(_ec.Object, "Gradle", ccInputs)); VerifyCoberturaCoverageForGradle(true); Assert.Equal(_warnings.Count, 0); Assert.Equal(_errors.Count, 0); }
public void Gradle_EnableCodeCoverageForEmptyBuildFile() { SetupMocks(); _sampleBuildFilePath = Path.Combine(Path.GetTempPath(), "build.gradle"); File.WriteAllText(_sampleBuildFilePath, string.Empty); var enableCodeCoverage = new CodeCoverageEnablerForCoberturaGradle(); enableCodeCoverage.Initialize(_hc); var ccInputs = new Dictionary<string, string>(); ccInputs.Add("buildfile", _sampleBuildFilePath); ccInputs.Add("classfilesdirectories", _classDirectories); ccInputs.Add("classfilter", _classFilter); ccInputs.Add("summaryfile", _summaryFile); ccInputs.Add("reportdirectory", _reportDirectory); ccInputs.Add("ismultimodule", "false"); Assert.Throws<InvalidOperationException>(() => enableCodeCoverage.EnableCodeCoverage(_ec.Object, new CodeCoverageEnablerInputs(_ec.Object, "Gradle", ccInputs))); }
public void Gradle_EnableCodeCoverageWithNoReportDirectory() { SetupMocks(); LoadBuildFile(CodeCoverageTestConstants.BuildGradle); var enableCodeCoverage = new CodeCoverageEnablerForCoberturaGradle(); enableCodeCoverage.Initialize(_hc); var ccInputs = new Dictionary<string, string>(); ccInputs.Add("buildfile", _sampleBuildFilePath); ccInputs.Add("classfilesdirectories", _classDirectories); ccInputs.Add("classfilter", _classFilter); ccInputs.Add("summaryfile", _summaryFile); ccInputs.Add("ismultimodule", "false"); Assert.Throws<ArgumentException>(() => enableCodeCoverage.EnableCodeCoverage(_ec.Object, new CodeCoverageEnablerInputs(_ec.Object, "Gradle", ccInputs))); }
public void Gradle_EnableCodeCoverageForNotExistingBuildFile() { SetupMocks(); _sampleBuildFilePath = Path.GetTempFileName(); _sampleBuildFilePath = Path.ChangeExtension(_sampleBuildFilePath, ".gradle"); var enableCodeCoverage = new CodeCoverageEnablerForCoberturaGradle(); enableCodeCoverage.Initialize(_hc); var ccInputs = new Dictionary<string, string>(); ccInputs.Add("buildfile", _sampleBuildFilePath); ccInputs.Add("classfilesdirectories", _classDirectories); ccInputs.Add("classfilter", _classFilter); ccInputs.Add("summaryfile", _summaryFile); ccInputs.Add("reportdirectory", _reportDirectory); ccInputs.Add("ismultimodule", "false"); Assert.Throws<FileNotFoundException>(() => enableCodeCoverage.EnableCodeCoverage(_ec.Object, new CodeCoverageEnablerInputs(_ec.Object, "Gradle", ccInputs))); }