Implement serialization of Settings and SettingsRepository.

- FIX: Stile werden jetzt gespeichert.
This commit is contained in:
Daniel Kraus
2015-08-11 16:12:39 +02:00
parent 53d13b394e
commit c9fc4a5fae
21 changed files with 593 additions and 44 deletions

View File

@ -27,7 +27,7 @@ namespace Tests.Controller
[TestFixture]
class SettingsRepositoryTest
{
SettingsRepository _savedSettings;
string _savedSettings;
[SetUp]
public void SetUp()

View File

@ -22,6 +22,7 @@ using System.Text;
using NUnit.Framework;
using zaaReloaded2.Controller;
using zaaReloaded2.Controller.Elements;
using System.IO;
namespace Tests.Controller
{
@ -49,5 +50,21 @@ namespace Tests.Controller
((Items)clone.Elements[1]).Content,
"Items content");
}
[Test]
public void PersistSettings()
{
string name = "hello world";
Settings persisting = new Settings(name, new List<ElementBase>() { new Items() });
persisting.ReferenceStyle = zaaReloaded2.Formatter.ReferenceStyle.IfSpecialItem;
MemoryStream s = new MemoryStream();
persisting.Persist(s);
s.Position = 0;
Settings retrieved = Settings.Unpersist(s);
Assert.AreEqual(persisting.Name, retrieved.Name, "Name");
Assert.AreEqual(persisting.ReferenceStyle, retrieved.ReferenceStyle, "ReferenceStyle");
}
}
}