Example #1
0
        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);
        }
Example #2
0
        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);
            }
        }
Example #3
0
        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);
        }