< Summary

Information
Class: ResultWriterTests.CsvResultWriterTests
Assembly: resultwritertests.dll
File(s): C:\skola_karlovka\RP\code\csv-validator\CSV_Validator\Tests\ResultWriterTests\CsvResultWriterTests.cs
Line coverage
100%
Covered lines: 45
Uncovered lines: 0
Coverable lines: 45
Total lines: 71
Line coverage: 100%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

File(s)

C:\skola_karlovka\RP\code\csv-validator\CSV_Validator\Tests\ResultWriterTests\CsvResultWriterTests.cs

#LineLine coverage
 1using ValidateLib.ResultCreators;
 2using ValidateLib.Results;
 3
 4namespace ResultWriterTests
 5{
 6    public class CsvResultWriterTests : BaseTest
 7    {
 8        [Fact]
 9        public void WriterCreatesAFile()
 110        {
 111            var resultWriter = ResultWriterFactory.CreateResultWriter(ResultFileFormat.CSV);
 112            var pathNonExisting = "non_existing.csv";
 113            resultWriter.GenerateResult(pathNonExisting, new TableGroupValidationResultDetails());
 114            Assert.True(File.Exists(pathNonExisting));
 115        }
 16
 17        [Fact]
 18        public void WriterCreatesNonEmptyFile()
 119        {
 120            var resultWriter = ResultWriterFactory.CreateResultWriter(ResultFileFormat.CSV);
 121            var pathNonExisting = "non_existing.csv";
 122            resultWriter.GenerateResult(pathNonExisting, new TableGroupValidationResultDetails());
 123            var content = File.ReadAllText(pathNonExisting);
 124            Assert.True(content != string.Empty);
 125        }
 26
 27        [Fact]
 28        public void WriterCreatesNonEmptyFileWithGeneralError()
 129        {
 130            var resultWriter = ResultWriterFactory.CreateResultWriter(ResultFileFormat.CSV);
 131            var pathNonExisting = "non_existing.csv";
 132            var tableGroupResults = GetResultWithGeneralError();
 133            resultWriter.GenerateResult(pathNonExisting, tableGroupResults);
 134            var content = File.ReadAllText(pathNonExisting);
 135            Assert.True(content != string.Empty);
 136        }
 37
 38        [Fact]
 39        public void WriterCreatesNonEmptyFileWithGeneralWarning()
 140        {
 141            var resultWriter = ResultWriterFactory.CreateResultWriter(ResultFileFormat.CSV);
 142            var pathNonExisting = "non_existing.csv";
 143            var tableGroupResults = GetResultWithGeneralWarning();
 144            resultWriter.GenerateResult(pathNonExisting, tableGroupResults);
 145            var content = File.ReadAllText(pathNonExisting);
 146            Assert.True(content != string.Empty);
 147        }
 48
 49        [Fact]
 50        public void WriterCreatesNonEmptyFileWithTableError()
 151        {
 152            var resultWriter = ResultWriterFactory.CreateResultWriter(ResultFileFormat.CSV);
 153            var pathNonExisting = "non_existing.csv";
 154            var tableGroupResults = GetResultWithTableError();
 155            resultWriter.GenerateResult(pathNonExisting, tableGroupResults);
 156            var content = File.ReadAllText(pathNonExisting);
 157            Assert.True(content != string.Empty);
 158        }
 59
 60        [Fact]
 61        public void WriterCreatesNonEmptyFileWithTableWarning()
 162        {
 163            var resultWriter = ResultWriterFactory.CreateResultWriter(ResultFileFormat.CSV);
 164            var pathNonExisting = "non_existing.csv";
 165            var tableGroupResults = GetResultWithTableWarning();
 166            resultWriter.GenerateResult(pathNonExisting, tableGroupResults);
 167            var content = File.ReadAllText(pathNonExisting);
 168            Assert.True(content != string.Empty);
 169        }
 70    }
 71}