public void CreateDataContainer_IsNotNull()
        {
            var items = new RepositoryData().DataRepository.Create(
                Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Desktop),
                    "2 year old patient list immunisation targets.csv"), new RepositoryMaps("2 year old patient list immunisation targets.xml").Maps);

            Assert.IsNotNull(items);
        }
コード例 #2
0
        public void DataRespostory_SavesOnDeskTop_ETAlsoDone()
        {
            var items = new RepositoryData().DataRepository.Create(
                        Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Desktop),
                        "2 year old patient list immunisation targets.csv"),
                        new RepositoryMaps("2 year old patient list immunisation targets.xml").Maps);

            items = new RepositoryData().DataRepository.Transform(
                                    new RepositoryMaps("2 year old patient list immunisation targets.xml").Maps,
                                    items);

            var filename = Path.Combine(
                Environment.GetFolderPath(Environment.SpecialFolder.Desktop),
                string.Format("{0}.Output.csv",
                    Path.GetFileNameWithoutExtension("2 year old patient list immunisation targets.csv")));

               new RepositoryData().DataRepository.Save(filename, items);

            Assert.IsTrue(File.Exists(filename));
        }
コード例 #3
0
ファイル: MainViewModel.cs プロジェクト: RazaToosy/CsvMapper
        public void DoExport()
        {
            try
            {
                ResultsViewContent += "\nCreating Export...";
                //Create ETL Layer
                string xmlFile =
                    Path.Combine(new FileInfo(System.Reflection.Assembly.GetEntryAssembly().Location).Directory.FullName,
                        string.Format("{0}.xml", Path.GetFileNameWithoutExtension(_inputFileLocation)));
                var service = new RepositoryData();
                var theContainer = new ModelDataContainer();

                //Extract
                theContainer = service.DataRepository.Create(this._inputFileLocation, new RepositoryMaps(xmlFile).Maps);

                //Transform
                theContainer = service.DataRepository.Transform(new RepositoryMaps(xmlFile).Maps, theContainer);

                //Load
                service.DataRepository.Save(Path.Combine(
                    Environment.GetFolderPath(Environment.SpecialFolder.Desktop),
                    string.Format("{0}.Output.csv", Path.GetFileNameWithoutExtension(_inputFileLocation))),
                    theContainer);

                ResultsViewContent += "\nOutput exported to the Desktop...";
            }
            catch (Exception ex)
            {
                LoggerSingleton.Instance.LogMessage(ex);
            }
        }