public void ExtractESDATDataFromNoHeaderFileTest()
        {
            var mockDefaultValueProvider = new Mock<IWQDefaultValueProvider>();
            mockDefaultValueProvider.Setup(x => x.OrganizationNameSampleCollection).Returns("Default organization name from provider");

            var chemistryFileToImport = CreateCSVDataToImport(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "DataFiles", "ChemistryFileExample.csv"));
            var sampleFileToImport = CreateCSVDataToImport(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "DataFiles", "SampleFileExample.csv"));

            var testESDATDataToImport = new ESDATDataToImport(null, sampleFileToImport, chemistryFileToImport);
            var simpleValueAssginer = new SimpleValueAssigner();

            var sampleDataImporter = ESDATTestHelper.BuildSampleDataFileImporter();
            var sampleFileChildObjectExtractConfiguration = new SampleFileChildObjectExtractConfiguration(sampleDataImporter, "SampleFileData", simpleValueAssginer);

            var chemistryDataImporter = ESDATTestHelper.BuildChemistryFileImporter();
            var chemistryFileChildObjectExtractConfiguration = new ChemistryFileChildObjectExtractConfiguration(chemistryDataImporter, "ChemistryData", simpleValueAssginer);

            var testESDATDataImporter = new ESDATDataImporter(ResultLevel.ERROR, mockDefaultValueProvider.Object);

            AddXMLExtractConfigurationsToImporter(testESDATDataImporter);
            testESDATDataImporter.AddExtractConfiguration(sampleFileChildObjectExtractConfiguration);
            testESDATDataImporter.AddExtractConfiguration(chemistryFileChildObjectExtractConfiguration);

            var extractResult = testESDATDataImporter.Extract<ESDATModel>(testESDATDataToImport);

            Assert.NotNull(extractResult);

            var entity = extractResult.ExtractedEntities.Cast<ESDATModel>().SingleOrDefault();

            Assert.NotNull(entity);
            Assert.AreEqual("Default organization name from provider", entity.LabName);
            Assert.AreEqual(3, entity.SampleFileData.Count());
            Assert.AreEqual(9, entity.ChemistryData.Count());
        }
        public static IDataImporter BuildESDATDataImporter(IWQDefaultValueProvider wqDefaultValueProvider)
        {
            var simpleValueAssginer = new SimpleValueAssigner();

            var sampleDataImporter = BuildSampleDataFileImporter();
            var sampleFileChildObjectExtractConfiguration = new SampleFileChildObjectExtractConfiguration(sampleDataImporter, "SampleFileData", simpleValueAssginer);

            var chemistryDataImporter = BuildChemistryFileImporter();
            var chemistryFileChildObjectExtractConfiguration = new ChemistryFileChildObjectExtractConfiguration(chemistryDataImporter, "ChemistryData", simpleValueAssginer);

            var ESDATDataImporter = new ESDATDataImporter(ResultLevel.ERROR, wqDefaultValueProvider);

            AddXMLExtractConfigurationsToImporter(ESDATDataImporter);
            ESDATDataImporter.AddExtractConfiguration(sampleFileChildObjectExtractConfiguration);
            ESDATDataImporter.AddExtractConfiguration(chemistryFileChildObjectExtractConfiguration);

            return ESDATDataImporter;
        }
        public void ChemistryFilePropertyTest()
        {
            var path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "DataFiles", "SampleFileExample.csv");
            var dataSource = new WindowsFileSystem(path);
            var dataFromFileSystem = dataSource.FetchData();
            var dataToImport = new CSVDataToImport(dataFromFileSystem);

            var simpleValueAssginer = new SimpleValueAssigner();

            var sampleDataImporter = ESDATTestHelper.BuildSampleDataFileImporter();

            var childObjectExtractConfiguration = new SampleFileChildObjectExtractConfiguration(sampleDataImporter, "SampleFileData", simpleValueAssginer);

            Assert.AreEqual(typeof(SampleFileData), childObjectExtractConfiguration.ChildObjectType);

            var testESDATModel = new ESDATModel();

            var extractResult = childObjectExtractConfiguration.ExtractData(testESDATModel, dataToImport);

            Assert.NotNull(extractResult);
            Assert.AreEqual(3, testESDATModel.SampleFileData.Count());

            var firstSampleData = testESDATModel.SampleFileData.FirstOrDefault();

            Assert.NotNull(firstSampleData);
            Assert.AreEqual("5828314", firstSampleData.SampleCode);
            Assert.AreEqual(new DateTime(2014, 9, 16), firstSampleData.SampledDateTime);
            Assert.AreEqual("FRL-1 @ 16:00", firstSampleData.FieldID);
            Assert.Null(firstSampleData.SampleDepth);
            Assert.AreEqual("Water", firstSampleData.MatrixType);
            Assert.AreEqual("Normal", firstSampleData.SampleType);
            Assert.AreEqual(string.Empty, firstSampleData.ParentSample);
            Assert.AreEqual("14J891101", firstSampleData.SDG);
            Assert.AreEqual("AGAT", firstSampleData.LabName);
            Assert.AreEqual("5828314", firstSampleData.LabSampleID);
            Assert.AreEqual(string.Empty, firstSampleData.Comments);
            Assert.AreEqual("14J891101", firstSampleData.LabReportNumber);
        }
        public static IExtractConfiguration CreateSampleFileDataExtractConfiguration()
        {
            var path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "DataFiles", "SampleFileExample.csv");
            var dataSource = new WindowsFileSystem(path);
            var dataFromFileSystem = dataSource.FetchData();
            var dataToImport = new CSVDataToImport(dataFromFileSystem);

            var simpleValueAssginer = new SimpleValueAssigner();

            var sampleDataImporter = ESDATTestHelper.BuildSampleDataFileImporter();

            var childObjectExtractConfiguration = new SampleFileChildObjectExtractConfiguration(sampleDataImporter, "SampleFileData", simpleValueAssginer);

            return childObjectExtractConfiguration;
        }