public void Constructor_ValidParameters_ExpectedValues() { // Setup string filePath = TestHelper.GetScratchPadPath($"{nameof(Constructor_ValidParameters_ExpectedValues)}.csv"); // Call var waveConditionsExporter = new TestWaveConditionsExporter(Array.Empty <ExportableWaveConditions>(), filePath); // Assert Assert.IsInstanceOf <IFileExporter>(waveConditionsExporter); }
public void Export_ValidData_ReturnTrue() { // Setup string directoryPath = TestHelper.GetScratchPadPath(nameof(Export_ValidData_ReturnTrue)); using (new DirectoryDisposeHelper(TestHelper.GetScratchPadPath(), nameof(Export_ValidData_ReturnTrue))) { string filePath = Path.Combine(directoryPath, "test.csv"); var waveConditionsExporter = new TestWaveConditionsExporter(Array.Empty <ExportableWaveConditions>(), filePath); // Call bool isExported = waveConditionsExporter.Export(); // Assert Assert.IsTrue(isExported); } }
public void Export_InvalidData_LogErrorAndFalse() { // Setup string filePath = TestHelper.GetScratchPadPath("test_.csv"); string invalidFilePath = filePath.Replace("_", ">"); var waveConditionsExporter = new TestWaveConditionsExporter(Array.Empty <ExportableWaveConditions>(), invalidFilePath); // Call var isExported = true; void Call() => isExported = waveConditionsExporter.Export(); // Assert string expectedMessage = $"Er is een onverwachte fout opgetreden tijdens het schrijven van het bestand '{invalidFilePath}'. " + "Er zijn geen golfcondities geƫxporteerd."; TestHelper.AssertLogMessageIsGenerated(Call, expectedMessage); Assert.IsFalse(isExported); }