Esempio n. 1
0
        /// <summary>
        /// Compares a found way to an expected way.
        /// </summary>
        /// <param name="expected"></param>
        /// <param name="actual"></param>
        public static void CompareSimple(Way expected, Way actual)
        {
            Assert.IsNotNull(expected);
            Assert.IsNotNull(actual);
            Assert.AreEqual(expected.Id, actual.Id);
            Assert.AreEqual(expected.ChangeSetId, actual.ChangeSetId);
            Assert.AreEqual(expected.TimeStamp, actual.TimeStamp);
            Assert.AreEqual(expected.Type, actual.Type);
            Assert.AreEqual(expected.UserId, actual.UserId);
            Assert.AreEqual(expected.UserName, actual.UserName);
            Assert.AreEqual(expected.Version, actual.Version);
            Assert.AreEqual(expected.Visible, actual.Visible);

            if (expected.Nodes == null)
            {
                Assert.IsNull(actual.Nodes);
            }
            else
            {
                Assert.IsNotNull(actual.Nodes);
                Assert.AreEqual(expected.Nodes.Count, actual.Nodes.Count);
                for (int idx = 0; idx < expected.Nodes.Count; idx++)
                {
                    Assert.AreEqual(expected.Nodes[idx], actual.Nodes[idx]);
                }
            }

            ComparisonHelpers.CompareTags(expected.Tags, actual.Tags);
        }
Esempio n. 2
0
        /// <summary>
        /// Compares a found node to an expected node.
        /// </summary>
        /// <param name="expected"></param>
        /// <param name="actual"></param>
        public static void CompareSimple(Node expected, Node actual)
        {
            Assert.IsNotNull(expected);
            Assert.IsNotNull(actual);
            Assert.AreEqual(expected.Id, actual.Id);
            Assert.AreEqual(expected.ChangeSetId, actual.ChangeSetId);
            Assert.AreEqual((float)expected.Latitude, (float)actual.Latitude);
            Assert.AreEqual((float)expected.Longitude, (float)actual.Longitude);
            Assert.AreEqual(expected.TimeStamp, actual.TimeStamp);
            Assert.AreEqual(expected.Type, actual.Type);
            Assert.AreEqual(expected.UserId, actual.UserId);
            Assert.AreEqual(expected.UserName, actual.UserName);
            Assert.AreEqual(expected.Version, actual.Version);
            Assert.AreEqual(expected.Visible, actual.Visible);

            ComparisonHelpers.CompareTags(expected.Tags, actual.Tags);
        }
Esempio n. 3
0
        /// <summary>
        /// Compares a found relation to an expected relation.
        /// </summary>
        /// <param name="expected"></param>
        /// <param name="actual"></param>
        public static void CompareSimple(Relation expected, Relation actual)
        {
            Assert.IsNotNull(expected);
            Assert.IsNotNull(actual);
            Assert.AreEqual(expected.Id, actual.Id);
            Assert.AreEqual(expected.ChangeSetId, actual.ChangeSetId);
            Assert.AreEqual(expected.TimeStamp, actual.TimeStamp);
            Assert.AreEqual(expected.Type, actual.Type);
            Assert.AreEqual(expected.UserId, actual.UserId);
            Assert.AreEqual(expected.UserName, actual.UserName);
            Assert.AreEqual(expected.Version, actual.Version);
            Assert.AreEqual(expected.Visible, actual.Visible);

            if (expected.Members == null)
            {
                Assert.IsNull(actual.Members);
            }
            else
            {
                Assert.IsNotNull(actual.Members);
                Assert.AreEqual(expected.Members.Count, actual.Members.Count);
                for (int idx = 0; idx < expected.Members.Count; idx++)
                {
                    Assert.AreEqual(expected.Members[idx].MemberId, actual.Members[idx].MemberId);
                    // the oracle database converts empty strings to null and does not follow standards.
                    // this is why there is this ugly code here matching empty strings to null.
                    if (expected.Members[idx].MemberRole == string.Empty &&
                        actual.Members[idx].MemberRole == null)
                    { // only for oracle!
                        Assert.AreEqual(null, actual.Members[idx].MemberRole);
                    }
                    else
                    {
                        Assert.AreEqual(expected.Members[idx].MemberRole, actual.Members[idx].MemberRole);
                    }
                    Assert.AreEqual(expected.Members[idx].MemberType, actual.Members[idx].MemberType);
                }
            }

            ComparisonHelpers.CompareTags(expected.Tags, actual.Tags);
        }