Beispiel #1
0
        /// <summary>
        /// Compares the two complete objects.
        /// </summary>
        /// <param name="expected"></param>
        /// <param name="actual"></param>
        public static void CompareComplete(CompleteWay expected, CompleteWay actual)
        {
            if (expected == null)
            { // ok, if the value is also null.
                Assert.IsNull(actual);
            }
            else
            { // check and compare the value.
                Assert.IsNotNull(actual);
                Assert.AreEqual(expected.Id, actual.Id);
                Assert.AreEqual(expected.ChangeSetId, actual.ChangeSetId);
                Assert.AreEqual(expected.TimeStamp, actual.TimeStamp);
                Assert.AreEqual(expected.User, actual.User);
                Assert.AreEqual(expected.UserId, actual.UserId);
                Assert.AreEqual(expected.Version, actual.Version);
                Assert.AreEqual(expected.Visible, actual.Visible);

                if (expected.Nodes == null)
                { // ok, if the value is also null.
                    Assert.IsNotNull(actual.Nodes);
                }
                else
                { // check and compare the nodes.
                    Assert.AreEqual(expected.Nodes.Count, actual.Nodes.Count);
                    for (int idx = 0; idx < expected.Nodes.Count; idx++)
                    {
                        ComparisonHelpers.CompareComplete(
                            expected.Nodes[idx], actual.Nodes[idx]);
                    }
                }
            }
        }
Beispiel #2
0
        /// <summary>
        /// Compares the two complete objects.
        /// </summary>
        /// <param name="expected"></param>
        /// <param name="actual"></param>
        public static void CompareComplete(CompleteRelation expected, CompleteRelation actual)
        {
            if (expected == null)
            { // ok, if the value is also null.
                Assert.IsNull(actual);
            }
            else
            { // check and compare the value.
                Assert.IsNotNull(actual);
                Assert.AreEqual(expected.Id, actual.Id);
                Assert.AreEqual(expected.ChangeSetId, actual.ChangeSetId);
                Assert.AreEqual(expected.TimeStamp, actual.TimeStamp);
                Assert.AreEqual(expected.User, actual.User);
                Assert.AreEqual(expected.UserId, actual.UserId);
                Assert.AreEqual(expected.Version, actual.Version);
                Assert.AreEqual(expected.Visible, actual.Visible);

                if (expected.Members == null)
                { // ok, if the value is also null.
                    Assert.IsNotNull(actual.Members);
                }
                else
                { // check and compare the nodes.
                    Assert.AreEqual(expected.Members.Count, actual.Members.Count);
                    for (int idx = 0; idx < expected.Members.Count; idx++)
                    {
                        CompleteRelationMember expectedMember = expected.Members[idx];
                        CompleteRelationMember actualMember   = actual.Members[idx];

                        Assert.AreEqual(expectedMember.Role, actualMember.Role);
                        Assert.IsNotNull(expectedMember.Member);
                        Assert.IsNotNull(actualMember.Member);
                        Assert.AreEqual(expectedMember.Member.Type, actualMember.Member.Type);

                        switch (expectedMember.Member.Type)
                        {
                        case CompleteOsmType.Node:
                            ComparisonHelpers.CompareComplete(
                                expectedMember.Member as Node,
                                actualMember.Member as Node);
                            break;

                        case CompleteOsmType.Way:
                            ComparisonHelpers.CompareComplete(
                                expectedMember.Member as CompleteWay,
                                actualMember.Member as CompleteWay);
                            break;

                        case CompleteOsmType.Relation:
                            ComparisonHelpers.CompareComplete(
                                expectedMember.Member as CompleteRelation,
                                actualMember.Member as CompleteRelation);
                            break;
                        }
                    }
                }
            }
        }
Beispiel #3
0
        /// <summary>
        /// Compares two lists of complete osm objects.
        /// </summary>
        /// <param name="expectedList"></param>
        /// <param name="actualList"></param>
        public static void CompareComplete(System.Collections.Generic.List <ICompleteOsmGeo> expectedList,
                                           System.Collections.Generic.List <ICompleteOsmGeo> actualList)
        {
            foreach (ICompleteOsmGeo actual in actualList)
            {
                foreach (ICompleteOsmGeo expected in
                         expectedList.Where((expected) => { return(expected.Id == actual.Id && expected.Type == actual.Type); }))
                {
                    switch (expected.Type)
                    {
                    case CompleteOsmType.Node:
                        ComparisonHelpers.CompareComplete(
                            expected as Node, actual as Node);
                        break;

                    case CompleteOsmType.Way:
                        ComparisonHelpers.CompareComplete(
                            expected as CompleteWay, actual as CompleteWay);
                        break;

                    case CompleteOsmType.Relation:
                        ComparisonHelpers.CompareComplete(
                            expected as CompleteRelation, actual as CompleteRelation);
                        break;
                    }
                }
            }
            foreach (ICompleteOsmGeo expected in expectedList)
            {
                foreach (ICompleteOsmGeo actual in
                         actualList.Where((actual) => { return(expected.Id == actual.Id && expected.Type == actual.Type); }))
                {
                    switch (expected.Type)
                    {
                    case CompleteOsmType.Node:
                        ComparisonHelpers.CompareComplete(
                            expected as Node, actual as Node);
                        break;

                    case CompleteOsmType.Way:
                        ComparisonHelpers.CompareComplete(
                            expected as CompleteWay, actual as CompleteWay);
                        break;

                    case CompleteOsmType.Relation:
                        ComparisonHelpers.CompareComplete(
                            expected as CompleteRelation, actual as CompleteRelation);
                        break;
                    }
                }
            }
        }