/// <summary>
        /// Checks that the results of the first and the second descriptor results are identical.
        /// </summary>
        /// <param name="v1">first <see cref="IDescriptorResult"/></param>
        /// <param name="v2">second <see cref="IDescriptorResult"/></param>
        /// <param name="errorMessage">error message to report when the results are not the same</param>
        private static void AssertEqualOutput(IDescriptorResult v1, IDescriptorResult v2, string errorMessage)
        {
            var vv1 = v1.Values.ToReadOnlyList();
            var vv2 = v2.Values.ToReadOnlyList();

            Assert.AreEqual(vv1.Count, vv2.Count);

            for (int i = 0; i < vv1.Count; i++)
            {
                var p1 = vv1[i];
                var p2 = vv2[i];
                switch (p1)
                {
                case int p:
                {
                    var pp = (int)p2;
                    Assert.AreEqual(p, pp, errorMessage);
                }
                break;

                case double p:
                {
                    var pp = (double)p2;
                    if (!(double.IsNaN(p) && double.IsNaN(pp)))
                    {
                        Assert.AreEqual(p, pp, 0.00001, errorMessage);
                    }
                }
                break;

                case bool p:
                {
                    var pp = (bool)p2;
                    Assert.AreEqual(p, pp, errorMessage);
                }
                break;
                }
            }
        }
示例#2
0
 public static string ToExcelString(IDescriptorResult result)
 {
     return(string.Join(", ", result.Values.Select(n => ToExcelString(n))));
 }