private Boolean GetNullDifference(out StructuralDifference difference)
        {
            var expectedObj = expected.Peek().Value;
            var actualObj   = actual.Peek().Value;

            difference = null;

            if (expectedObj == null)
            {
                if (actualObj != null)
                {
                    difference = new StructuralDifference(String.Format("Difference at {0}. Expected: null, but actual was: {1}", GetName(expected), actualObj));
                    return(false);
                }

                return(true);
            }

            if (actualObj == null)
            {
                difference = new StructuralDifference(String.Format("Difference at {0}. Expected: {1}, but actual was: null", GetName(expected), expectedObj));
            }

            return(false);
        }
        private Boolean GetCircularRefsDifference(out StructuralDifference difference)
        {
            var expectedCircRefIndexes = expected.Select((f, i) => new { Index = i, Field = f })
                                         .Where(obj => Object.ReferenceEquals(obj.Field.Value, expected.Peek().Value))
                                         .Select(obj => obj.Index)
                                         .ToArray();

            var actualCircRefIndexes = actual.Select((f, i) => new { Index = i, Field = f })
                                       .Where(obj => Object.ReferenceEquals(obj.Field.Value, actual.Peek().Value))
                                       .Select(obj => obj.Index)
                                       .ToArray();

            var expectedCircRefString = String.Join(",", expectedCircRefIndexes.Select(n => n.ToString()));
            var actualCircRefString   = String.Join(",", actualCircRefIndexes.Select(n => n.ToString()));

            if (expectedCircRefString != actualCircRefString)
            {
                difference = new StructuralDifference(String.Format("Difference at {0}. Expected to find circular references: {1}, but got: {2}", GetName(expected), expectedCircRefString, actualCircRefString));
                return(false);
            }

            difference = null;
            return(expectedCircRefIndexes.Length > 1);
        }
        private Boolean GetNullDifference(out StructuralDifference difference)
        {
            var expectedObj = expected.Peek().Value;
            var actualObj = actual.Peek().Value;
            difference = null;

            if (expectedObj == null)
            {
                if (actualObj != null)
                {
                    difference = new StructuralDifference(String.Format("Difference at {0}. Expected: null, but actual was: {1}", GetName(expected), actualObj));
                    return false;
                }

                return true;
            }

            if (actualObj == null)
            {
                difference = new StructuralDifference(String.Format("Difference at {0}. Expected: {1}, but actual was: null", GetName(expected), expectedObj));
            }

            return false;
        }
        private Boolean GetCircularRefsDifference(out StructuralDifference difference)
        {
            var expectedCircRefIndexes = expected.Select((f, i) => new { Index = i, Field = f })
                                                 .Where(obj => Object.ReferenceEquals(obj.Field.Value, expected.Peek().Value))
                                                 .Select(obj => obj.Index)
                                                 .ToArray();

            var actualCircRefIndexes = actual.Select((f, i) => new { Index = i, Field = f })
                                             .Where(obj => Object.ReferenceEquals(obj.Field.Value, actual.Peek().Value))
                                             .Select(obj => obj.Index)
                                             .ToArray();

            var expectedCircRefString = String.Join(",", expectedCircRefIndexes.Select(n => n.ToString()));
            var actualCircRefString = String.Join(",", actualCircRefIndexes.Select(n => n.ToString()));

            if (expectedCircRefString != actualCircRefString)
            {
                difference = new StructuralDifference(String.Format("Difference at {0}. Expected to find circular references: {1}, but got: {2}", GetName(expected), expectedCircRefString, actualCircRefString));
                return false;
            }

            difference = null;
            return expectedCircRefIndexes.Length > 1;
        }