Exemple #1
0
        public void TestToStringSaveToFile()
        {
            var l = new LegendViewModel(30, 0);

            var Expectlist = l.ListOfLagendItems.ToList();
            var str        = l.ToString();

            var path = @"F:\scale.scl";

            LoadSaveFromToTextFile.SaveFile(str, path);

            Assert.IsTrue(File.Exists(path));

            TempFileManager.DeleteTmpFile(path);
        }
 private async Task Save()
 {
     try
     {
         WinForms.SaveFileDialog dialog = new WinForms.SaveFileDialog();
         dialog.Filter     = "Files | *.scl;";
         dialog.DefaultExt = ".scl";
         if (dialog.ShowDialog() == WinForms.DialogResult.OK)
         {
             LoadSaveFromToTextFile.SaveFile(this.ToString(), dialog.FileName);
         }
     }
     catch (Exception ex)
     {
         throw new Exception("Saving error");
     }
 }
Exemple #3
0
        public void TestReadAndPopulateFromFile()
        {
            var l = new LegendViewModel(30, 0);

            var Expectlist = l.ListOfLagendItems.ToList();
            var str        = l.ToString();

            var path = @"F:\scale.scl";

            LoadSaveFromToTextFile.SaveFile(str, path);


            var Getslist = l.PopulateTableFromString(LoadSaveFromToTextFile.ReadFile(path));

            TempFileManager.DeleteTmpFile(path);

            Getslist.ForEach(x =>
            {
                Assert.AreEqual(Expectlist[Getslist.IndexOf(x)], x);
            });
        }