예제 #1
0
        private static void CompareNested(NestedType expectedType, NestedType actualType)
        {
            Assert.AreEqual(expectedType.Fields.Count, actualType.Fields.Count);

            for (int i = 0; i < expectedType.Fields.Count; i++)
            {
                FieldComparer.Compare(expectedType.Fields[i], actualType.Fields[i]);
            }
        }
예제 #2
0
        public static void Compare(Schema expected, Schema actual)
        {
            if (ReferenceEquals(expected, actual))
            {
                return;
            }

            Assert.AreEqual(expected.HasMetadata, actual.HasMetadata);
            if (expected.HasMetadata)
            {
                Assert.AreEqual(expected.Metadata.Keys.Count(), actual.Metadata.Keys.Count());
                Assert.True(expected.Metadata.Keys.All(k => actual.Metadata.ContainsKey(k) && expected.Metadata[k] == actual.Metadata[k]));
                Assert.True(actual.Metadata.Keys.All(k => expected.Metadata.ContainsKey(k) && actual.Metadata[k] == expected.Metadata[k]));
            }

            Assert.AreEqual(expected.Fields.Count, actual.Fields.Count);
            Assert.True(expected.Fields.Keys.All(k => actual.Fields.ContainsKey(k)));
            foreach (string name in expected.Fields.Keys)
            {
                FieldComparer.Compare(expected.Fields[name], actual.Fields[name]);
            }
        }