Esempio n. 1
0
        private void ToolStripButtonExport_Click(object sender, EventArgs e)
        {
            var fileName = (Controller?.Source?.ConnectionName ?? string.Empty).Replace(" ", "") + "To" + (Controller?.Target?.ConnectionName ?? string.Empty).Replace(" ", "") + ".csv";

            if (!string.IsNullOrWhiteSpace(saveFileDialog1.FileName))
            {
                var directory = Path.GetDirectoryName(saveFileDialog1.FileName);
                fileName = Path.Combine(directory, fileName);
            }

            saveFileDialog1.FileName = fileName;

            if (saveFileDialog1.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            var file   = saveFileDialog1.FileName;
            var export = new List <CarfupStep>();

            export.AddRange(StepsCrmSource);
            export.AddRange(StepsCrmTarget);

            var csv = export.OrderBy(s => s.AssemblyName)
                      .ThenBy(s => s.PluginTypeName)
                      .ThenBy(s => s.StepName)
                      .Select(s => s.ToCsv()).ToList();

            csv.Insert(0, CarfupStep.GetCsvColumns());
            File.WriteAllText(file, string.Join(Environment.NewLine, csv));
        }
        public void Compare_EntireOrg_Should_Compare()
        {
            var settings    = new PluginSettings();
            var sourceStep  = OrgComparisonMethod.Instance.GetSteps(null, settings, null);
            var targetSteps = OrgComparisonMethod.Instance.GetSteps(null, settings, null);

            Comparer.Compare(sourceStep, targetSteps);

            sourceStep.AddRange(targetSteps);

            var csv = sourceStep.OrderBy(s => s.AssemblyName)
                      .ThenBy(s => s.PluginTypeName)
                      .ThenBy(s => s.StepName)
                      .Select(s => s.ToCsv()).ToList();

            csv.Insert(0, CarfupStep.GetCsvColumns());
            File.WriteAllText(@"C:\Temp\UnitTest.csv", string.Join(Environment.NewLine, csv));
        }