public void RemoveConfigurationTest() { string path = Path.Combine(provider.UserDataFolderPath, TestLayoutFile); foreach (string file in Directory.EnumerateFiles(provider.UserDataFolderPath)) { if (file.IndexOf(path) == 0 && file.Contains(".bak")) { File.Delete(file); } } AppLayout al = new AppLayout(10, 11); al.SerializeInJSON(path); ConfigurationBase.RemoveConfiguration(path); Assert.IsFalse(File.Exists(path)); bool bakExists = false; foreach (string file in Directory.EnumerateFiles(provider.UserDataFolderPath)) { if (file.IndexOf(path) == 0 && file.Contains(".bak")) { bakExists = true; File.Delete(file); break; } } Assert.IsTrue(bakExists); }
public void LoadDefaultAppLayoutTest() { string path = Path.Combine(provider.UserDataFolderPath, TestLayoutFile); AppLayout al = new AppLayout(10, 11); al.LayoutLive.Height = 800; al.LayoutSnapshot.RowPropertiesHeight = 500; al.SerializeInJSON(path); AppLayout loadedAl = AppLayout.LoadFromJSON <AppLayout>(path); loadedAl.LoadLayoutIfPrevVersion(2, 2); System.IO.File.Delete(path); Assert.AreEqual(460, loadedAl.LayoutLive.Width); Assert.AreEqual(800, loadedAl.LayoutLive.Height); Assert.AreEqual(46 * 7, loadedAl.LayoutLive.RowPropertiesHeight); Assert.AreEqual(0, loadedAl.LayoutLive.RowTestHeight); Assert.AreEqual(870, loadedAl.LayoutSnapshot.Width); Assert.AreEqual(720, loadedAl.LayoutSnapshot.Height); Assert.AreEqual(410, loadedAl.LayoutSnapshot.ColumnSnapWidth); Assert.AreEqual(500, loadedAl.LayoutSnapshot.RowPropertiesHeight); Assert.AreEqual(260, loadedAl.LayoutSnapshot.RowTestHeight); Assert.AreEqual(AppLayout.CurrentVersion, loadedAl.Version); Assert.AreEqual(10, loadedAl.Top); Assert.AreEqual(11, loadedAl.Left); }