public void Compare_Object_With_Dictionary_Property()
{
var comparer = SutEngine.Get<HasDictionary>();
var oldModel = new HasDictionary
{
Names = new Dictionary<string, string>
{
{"fr", "Salut"},
{"en", "Hi"}
}
};
var newModel = new HasDictionary
{
Names = new Dictionary<string, string>
{
{"en", "Hello"},
{"es", "Hola"}
}
};
var changes = comparer(oldModel, newModel);
Assert.AreEqual(changes.Count(), 3);
Assert.IsNotNull(changes.Single(x => x.Name == "Names.fr" && (string)x.OldValue == "Salut"));
Assert.IsNotNull(changes.Single(x => x.Name == "Names.es" && (string)x.NewValue == "Hola"));
Assert.IsNotNull(changes.Single(x => x.Name == "Names.en" && (string)x.OldValue == "Hi" && (string)x.NewValue == "Hello"));
}