Esempio n. 1
0
        public void SerializeTilesTest()
        {
            TileInSpace.ResetCounter();
            FloatingObjectInSpace.ResetCounter();

            //Set test Floating objects set
            FloatingObjectInSpace testFloatingObjectInSpace = new FloatingObjectInSpace(v_TestFloatingObject, new Point3D(0, 0, 0));
            FloatingObjectsSet    testFloatingObjectsSet    = new FloatingObjectsSet {
                testFloatingObjectInSpace
            };

            //Set test Tile set
            List <Point3D> testPointList = new List <Point3D>()
            {
                new Point3D(1, 1, 1), new Point3D(2, 2, 2)
            };
            Tile baseObject = new Tile("testName", testPointList, null, null, null, Color.Black);
            List <TileInSpace> testTilesList = new List <TileInSpace> {
                new TileInSpace(baseObject, Point3D.Origin, Quaternion.One)
            };

            SerializeSnapshot testSnapshot = new SerializeSnapshot(c_TestMSystemDescription, new List <Tile> {
                baseObject
            });

            testSnapshot.Serialize(0, testFloatingObjectsSet, testTilesList);
            string    serializedSnapShot = testSnapshot.GetXmlDocAsAString();
            XDocument expecteDocument    = XDocument.Load("../../Classes/Xml/TestXML/serializedSnapShotTest.xml");

            //TODO Due to TileInSpace static counter this test fails if you use "run all tests".
            Assert.AreEqual(expecteDocument.ToString(), serializedSnapShot); //Compare both documents.
        }
Esempio n. 2
0
        public void TestConstructor()
        {
            SerializeSnapshot testSnapshot = new SerializeSnapshot(c_TestMSystemDescription, v_EmptyTiles);

            Assert.AreEqual("<root><MSystemDescription><tiling></tiling><Msystem></Msystem></MSystemDescription><snapshots/></root>",
                            Regex.Replace(testSnapshot.GetXmlDocAsAString(), @"\s+", ""));//Regex removes all whitespaces
        }