public void Compare_Dictionary_With_Deep_Compare()
{
SutEngine.Configure<ObjectDictionary>();
var oldModel = new ObjectDictionary()
{
Nested = new Dictionary<int, GrandChildModel>()
{
{1, new GrandChildModel()
{
Id = 100,
Name = "Name 1",
Value = 100
}},
{2, new GrandChildModel()
{
Id = 200,
Name = "Name 2",
Value = 200
}},
}
};
var newModel = new ObjectDictionary()
{
Nested = new Dictionary<int, GrandChildModel>()
{
{1, new GrandChildModel()
{
Id = 100,
Name = "Name 1 - Changed",
Value = 150
}},
{3, new GrandChildModel()
{
Id = 300,
Name = "Name 3",
Value = 300
}},
}
};
var changes = SutEngine.Compare(oldModel, newModel);
Assert.AreEqual(changes.Count(), 8);
Assert.IsNotNull(changes.Single(x => x.Name == "Nested.1.Value"));
}