Exception when comparing root elements
This issue was detected when comparing root elements, for example, of a value type. When change is detected in the root element, a null reference exception is launched when creating the ChangeRecord (CreateChange() method):
var displayName = currentMember.DisplayName ?? propertyName.ToSpacedWords();
It seems to be caused by the currentMember variable, which is null when comparing root elements.
Code snippet to reproduce the error:
int original = 1;
int current = 2;
var comparer = new EntityComparer();
var changes = comparer.Compare(original, current);
With further testing, now comparing arrays as root nodes, I found another exception in the method CompareByIndexer<T>:
When peeking the pathStack, an InvalidOperationException is thrown because it is empty:
var currentPath = _pathStack.peek().
Changing that line for var currentPath = CurrentPath() seems to solve the issue.
Edit: Apparently, I introduced this bug while fixing #5, and applying the proposed fix causes a regression. I'll try to look up for another solution.