public void Import_CancelingImport_CancelImportAndLog(string expectedProgressMessage)
        {
            // Setup
            var calculationGroup = new CalculationGroup();

            string filePath = Path.Combine(readerPath, "validConfiguration.xml");
            var importer = new CalculationConfigurationImporter(filePath, calculationGroup);

            importer.SetProgressChanged((description, step, steps) =>
            {
                if (description.Contains(expectedProgressMessage))
                {
                    importer.Cancel();
                }
            });

            // Call
            var importSuccessful = true;
            void Call() => importSuccessful = importer.Import();

            // Assert
            TestHelper.AssertLogMessageIsGenerated(Call, "Berekeningenconfiguratie importeren afgebroken. Geen gegevens gewijzigd.", 1);
            CollectionAssert.IsEmpty(calculationGroup.Children);
            Assert.IsFalse(importSuccessful);
        }
        public void GivenImport_WhenImporting_ThenExpectedProgressMessagesGenerated()
        {
            // Given
            string filePath = Path.Combine(readerPath, "validConfiguration.xml");
            var progressChangeNotifications = new List<ProgressNotification>();

            var importer = new CalculationConfigurationImporter(filePath, new CalculationGroup());
            importer.SetProgressChanged((description, step, steps) => progressChangeNotifications.Add(
                                            new ProgressNotification(description, step, steps)));

            // When
            importer.Import();

            // Then
            var expectedProgressNotifications = new[]
            {
                new ProgressNotification("Inlezen berekeningenconfiguratie.", 1, 3),
                new ProgressNotification("Valideren berekeningenconfiguratie.", 2, 3),
                new ProgressNotification("Geïmporteerde data toevoegen aan het faalmechanisme.", 3, 3)
            };
            ProgressNotificationTestHelper.AssertProgressNotificationsAreEqual(expectedProgressNotifications, progressChangeNotifications);
        }