Beispiel #1
0
        public void ShouldSaveTwoFile()
        {
            RemoveTempFolder();

            TempSaveable tempSaveable = new TempSaveable()
            {
                Modifyed = true
            };
            TempSaveableAnotherName tempSaveableB = new TempSaveableAnotherName()
            {
                Modifyed = true
            };
            PersistenceHelper <ISaveable> ph = new PersistenceHelper <ISaveable>(GetOutputFolder());
            bool results = ph.SaveData(new List <ISaveable>()
            {
                tempSaveable, tempSaveableB
            });

            results.Should().BeTrue();
            string finalName = Path.Combine(GetOutputFolder(), "TestSave.data");

            File.Exists(finalName).Should().BeTrue();

            finalName = Path.Combine(GetOutputFolder(), "TestSave2.data");
            File.Exists(finalName).Should().BeTrue();
        }
Beispiel #2
0
 public void Save()
 {
     lock (_shows)
     {
         PersistenceHelper <ShowControl> ph = new PersistenceHelper <ShowControl>(_outputFolder);
         ph.SaveData(_shows);
     }
 }
Beispiel #3
0
        public void ShouldSaveOneFile()
        {
            RemoveTempFolder();

            TempSaveable tempSaveable = new TempSaveable()
            {
                Modifyed = true
            };
            PersistenceHelper <ISaveable> ph = new PersistenceHelper <ISaveable>(GetOutputFolder());

            ph.SaveData(new List <ISaveable>()
            {
                tempSaveable
            });

            string finalName = Path.Combine(GetOutputFolder(), "TestSave.data");

            File.Exists(finalName).Should().BeTrue();
        }
Beispiel #4
0
        public void ShouldLoadSavedData()
        {
            RemoveTempFolder();

            TempSaveable tempSaveable = new TempSaveable
            {
                Name      = "MyName",
                OtherData = "OtherData",
                Modifyed  = true
            };
            PersistenceHelper <TempSaveable> ph = new PersistenceHelper <TempSaveable>(GetOutputFolder());

            ph.SaveData(new List <ISaveable>()
            {
                tempSaveable
            });

            ObservableCollection <TempSaveable> loadItems = ph.LoadData();

            loadItems.Should().HaveCount(1);
            loadItems[0].Name.Should().Be("MyName");
            loadItems[0].OtherData.Should().Be("OtherData");
        }