コード例 #1
0
        public void VerifySnippetDataPresent()
        {
            var markupXml  = XmlUtilities.GetElementFromZipFile(CreatedArchive, BcFv2TestCaseData.MAXIMUM_INFORMATION_TOPIC_GUID + "/markup.bcf");
            var snippetXml = markupXml.Descendants("BimSnippet").FirstOrDefault();

            Assert.NotNull(snippetXml.Descendants("Reference"));
            Assert.NotNull(snippetXml.Descendants("ReferenceSchema"));
            Assert.NotNull(snippetXml.Attribute("SnippetType"));

            // isExternal is false by default, so if the actual element points to an external snippet
            // the XML attribute may be omitted
            if (MaximumInformationTestCase.CreateTopic().Markup.Topic.BimSnippet.isExternal)
            {
                Assert.NotNull(snippetXml.Attribute("isExternal"));
                Assert.Equal("true", snippetXml.Attribute("isExternal").Value);
            }
            else
            {
                // But if it is false AND the attribute is present, it must be set to false
                if (snippetXml.Attribute("isExternal") != null)
                {
                    Assert.Equal("false", snippetXml.Attribute("isExternal").Value);
                }
            }
        }
コード例 #2
0
        public void VerifyCommentCorrect_04()
        {
            var markupXml       = XmlUtilities.GetElementFromZipFile(CreatedArchive, BcFv2TestCaseData.MAXIMUM_INFORMATION_TOPIC_GUID + "/markup.bcf");
            var commentExpected = MaximumInformationTestCase.CreateComments().ToList()[3];
            var commentActual   = TestUtilities.GetCommentFromXml(markupXml.Descendants("Comment").Where(curr => curr.Parent.Name.LocalName != "Comment").ToList()[3]);

            TopicsCompareTool.CompareSingleComment(commentExpected, commentActual);
        }
コード例 #3
0
        public void Viewpoint_03_PerspectiveCameraCorrect()
        {
            var viewpointXml   = XmlUtilities.GetElementFromZipFile(CreatedArchive, BcFv2TestCaseData.MAXIMUM_INFORMATION_TOPIC_GUID + "/Viewpoint_" + BcFv2TestCaseData.MAXIMUM_INFORMATION_VIEWPOINT_GUID_03 + ".bcfv");
            var cameraXml      = viewpointXml.DescendantNodes().OfType <XElement>().FirstOrDefault(curr => curr.Name.LocalName == "PerspectiveCamera");
            var cameraActual   = TestUtilities.GetPerspectiveCameraObjectFromXml(cameraXml);
            var cameraExpected = MaximumInformationTestCase.GetCamera_03();

            TopicsCompareTool.ComparePerspectiveCameras(cameraExpected, cameraActual);
        }
コード例 #4
0
        public void VerifySnippetDataCorrect()
        {
            var markupXml  = XmlUtilities.GetElementFromZipFile(CreatedArchive, BcFv2TestCaseData.MAXIMUM_INFORMATION_TOPIC_GUID + "/markup.bcf");
            var snippetXml = markupXml.Descendants("BimSnippet").FirstOrDefault();

            var snippetExpected = MaximumInformationTestCase.CreateTopic().Markup.Topic.BimSnippet;

            var snippetActual = TestUtilities.GetBimSnippetFromXml(snippetXml);

            TopicsCompareTool.CompareBimSnippet(snippetExpected, snippetActual);
        }
コード例 #5
0
        public void Viewpoint_01_LinesSet()
        {
            var viewpointXml = XmlUtilities.GetElementFromZipFile(CreatedArchive, BcFv2TestCaseData.MAXIMUM_INFORMATION_TOPIC_GUID + "/Viewpoint_" + BcFv2TestCaseData.MAXIMUM_INFORMATION_VIEWPOINT_GUID_01 + ".bcfv");

            var lines = viewpointXml.Descendants("Lines").FirstOrDefault().Descendants("Line").Select(curr => new
            {
                StartPoint = new
                {
                    x = Convert.ToDouble(curr.Descendants("StartPoint").First().Descendants("X").First().Value, CultureInfo.InvariantCulture),
                    y = Convert.ToDouble(curr.Descendants("StartPoint").First().Descendants("Y").First().Value, CultureInfo.InvariantCulture),
                    z = Convert.ToDouble(curr.Descendants("StartPoint").First().Descendants("Z").First().Value, CultureInfo.InvariantCulture)
                },
                EndPoint = new
                {
                    x = Convert.ToDouble(curr.Descendants("EndPoint").First().Descendants("X").First().Value, CultureInfo.InvariantCulture),
                    y = Convert.ToDouble(curr.Descendants("EndPoint").First().Descendants("Y").First().Value, CultureInfo.InvariantCulture),
                    z = Convert.ToDouble(curr.Descendants("EndPoint").First().Descendants("Z").First().Value, CultureInfo.InvariantCulture)
                }
            });

            var expectedLines = MaximumInformationTestCase.GetLines().ToList();
            var actualLines   = lines.ToList();

            Assert.Equal(expectedLines.Count, actualLines.Count);

            for (var i = 0; i < expectedLines.Count; i++)
            {
                // start
                Assert.Equal(expectedLines[i].StartPoint.X, actualLines[i].StartPoint.x);
                Assert.Equal(expectedLines[i].StartPoint.Y, actualLines[i].StartPoint.y);
                Assert.Equal(expectedLines[i].StartPoint.Z, actualLines[i].StartPoint.z);

                //end
                Assert.Equal(expectedLines[i].EndPoint.X, actualLines[i].EndPoint.x);
                Assert.Equal(expectedLines[i].EndPoint.Y, actualLines[i].EndPoint.y);
                Assert.Equal(expectedLines[i].EndPoint.Z, actualLines[i].EndPoint.z);
            }
        }
コード例 #6
0
        public void Viewpoint_01_ClippingPlanesSet()
        {
            var viewpointXml = XmlUtilities.GetElementFromZipFile(CreatedArchive, BcFv2TestCaseData.MAXIMUM_INFORMATION_TOPIC_GUID + "/Viewpoint_" + BcFv2TestCaseData.MAXIMUM_INFORMATION_VIEWPOINT_GUID_01 + ".bcfv");
            var planes       = viewpointXml.Descendants("ClippingPlanes").FirstOrDefault().Descendants("ClippingPlane").Select(curr => new
            {
                Location = new
                {
                    x = Convert.ToDouble(curr.Descendants("Location").First().Descendants("X").First().Value, CultureInfo.InvariantCulture),
                    y = Convert.ToDouble(curr.Descendants("Location").First().Descendants("Y").First().Value, CultureInfo.InvariantCulture),
                    z = Convert.ToDouble(curr.Descendants("Location").First().Descendants("Z").First().Value, CultureInfo.InvariantCulture)
                },
                Direction = new
                {
                    x = Convert.ToDouble(curr.Descendants("Direction").First().Descendants("X").First().Value, CultureInfo.InvariantCulture),
                    y = Convert.ToDouble(curr.Descendants("Direction").First().Descendants("Y").First().Value, CultureInfo.InvariantCulture),
                    z = Convert.ToDouble(curr.Descendants("Direction").First().Descendants("Z").First().Value, CultureInfo.InvariantCulture)
                }
            });

            var expectedPlanes = MaximumInformationTestCase.GetPlanes().ToList();
            var actualPlanes   = planes.ToList();

            Assert.Equal(expectedPlanes.Count, actualPlanes.Count);

            for (var i = 0; i < expectedPlanes.Count; i++)
            {
                // location
                Assert.Equal(expectedPlanes[i].Location.X, actualPlanes[i].Location.x);
                Assert.Equal(expectedPlanes[i].Location.Y, actualPlanes[i].Location.y);
                Assert.Equal(expectedPlanes[i].Location.Z, actualPlanes[i].Location.z);

                //direction
                Assert.Equal(expectedPlanes[i].Direction.X, actualPlanes[i].Direction.x);
                Assert.Equal(expectedPlanes[i].Direction.Y, actualPlanes[i].Direction.y);
                Assert.Equal(expectedPlanes[i].Direction.Z, actualPlanes[i].Direction.z);
            }
        }