Ejemplo n.º 1
0
        /// <summary>Assert the records match.</summary>
        /// <param name="source">record that was written</param>
        /// <param name="resolved">the one that resolved.</param>
        public static void AssertMatches(ServiceRecord source, ServiceRecord resolved)
        {
            NUnit.Framework.Assert.IsNotNull("Null source record ", source);
            NUnit.Framework.Assert.IsNotNull("Null resolved record ", resolved);
            NUnit.Framework.Assert.AreEqual(source.description, resolved.description);
            IDictionary <string, string> srcAttrs      = source.Attributes();
            IDictionary <string, string> resolvedAttrs = resolved.Attributes();
            string sourceAsString   = source.ToString();
            string resolvedAsString = resolved.ToString();

            NUnit.Framework.Assert.AreEqual("Wrong count of attrs in \n" + sourceAsString + "\nfrom\n"
                                            + resolvedAsString, srcAttrs.Count, resolvedAttrs.Count);
            foreach (KeyValuePair <string, string> entry in srcAttrs)
            {
                string attr = entry.Key;
                NUnit.Framework.Assert.AreEqual("attribute " + attr, entry.Value, resolved.Get(attr
                                                                                               ));
            }
            NUnit.Framework.Assert.AreEqual("wrong external endpoint count", source.external.
                                            Count, resolved.external.Count);
            NUnit.Framework.Assert.AreEqual("wrong external endpoint count", source.@internal
                                            .Count, [email protected]);
        }