|
| 1 | +// Copyright (c) Toni Solarin-Sodara |
| 2 | +// Licensed under the MIT license. See LICENSE file in the project root for full license information. |
| 3 | + |
| 4 | +using Coverlet.Collector.DataCollection; |
| 5 | +using Xunit; |
| 6 | + |
| 7 | +namespace Coverlet.Collector.Tests.DataCollection |
| 8 | +{ |
| 9 | + public class CoverletSettingsTests |
| 10 | + { |
| 11 | + [Fact] |
| 12 | + public void ToString_ReturnsCorrectFormat() |
| 13 | + { |
| 14 | + // Arrange |
| 15 | + var settings = new CoverletSettings |
| 16 | + { |
| 17 | + TestModule = "TestModule.dll", |
| 18 | + ReportFormats = new[] { "json", "lcov" }, |
| 19 | + IncludeFilters = new[] { "[*]*" }, |
| 20 | + IncludeDirectories = new[] { "dir1", "dir2" }, |
| 21 | + ExcludeFilters = new[] { "[*]ExcludeNamespace.*" }, |
| 22 | + ExcludeSourceFiles = new[] { "file1.cs", "file2.cs" }, |
| 23 | + ExcludeAttributes = new[] { "ExcludeAttribute" }, |
| 24 | + MergeWith = "coverage.json", |
| 25 | + UseSourceLink = true, |
| 26 | + SingleHit = false, |
| 27 | + IncludeTestAssembly = true, |
| 28 | + SkipAutoProps = false, |
| 29 | + DoesNotReturnAttributes = new[] { "DoesNotReturn" }, |
| 30 | + DeterministicReport = true, |
| 31 | + ExcludeAssembliesWithoutSources = "true" |
| 32 | + }; |
| 33 | + |
| 34 | + var expectedString = "TestModule: 'TestModule.dll', " + |
| 35 | + "IncludeFilters: '[*]*', " + |
| 36 | + "IncludeDirectories: 'dir1,dir2', " + |
| 37 | + "ExcludeFilters: '[*]ExcludeNamespace.*', " + |
| 38 | + "ExcludeSourceFiles: 'file1.cs,file2.cs', " + |
| 39 | + "ExcludeAttributes: 'ExcludeAttribute', " + |
| 40 | + "MergeWith: 'coverage.json', " + |
| 41 | + "UseSourceLink: 'True'" + |
| 42 | + "SingleHit: 'False'" + |
| 43 | + "IncludeTestAssembly: 'True'" + |
| 44 | + "SkipAutoProps: 'False'" + |
| 45 | + "DoesNotReturnAttributes: 'DoesNotReturn'" + |
| 46 | + "DeterministicReport: 'True'" + |
| 47 | + "ExcludeAssembliesWithoutSources: 'true'"; |
| 48 | + |
| 49 | + // Act |
| 50 | + var result = settings.ToString(); |
| 51 | + |
| 52 | + // Assert |
| 53 | + Assert.Equal(expectedString, result); |
| 54 | + } |
| 55 | + } |
| 56 | +} |
0 commit comments