Exemplo n.º 1
0
        public void GetObjectsNearProteinTest()
        {
            TileInSpace.ResetCounter();
            FloatingObjectInSpace.ResetCounter();

            var       testTile    = _testTilesWorld.First();
            var       testProtein = testTile.Proteins.First();
            const int count       = 20;

            int[] results = new int[count];
            for (var i = 0; i < count; i++)
            {
                results[i] = _testFltObjectsWorld.GetNearObjects(testProtein, Tile.SideType.outside, v_InfiniteMultiset).Count;
                _testFltObjectsWorld.FinalizeStep();
            }
            Assert.AreEqual(2500, results.Sum(), 500);

            for (var i = 0; i < count; i++)
            {
                results[i] = _testFltObjectsWorld.GetNearObjects(testProtein, Tile.SideType.inside, v_InfiniteMultiset).Count;
                _testFltObjectsWorld.FinalizeStep();
            }
            Assert.AreEqual(2400, results.Sum(), 500);
            //Assert.AreEqual("Result=", string.Join(";", results)); // DEBUGGING
        }
Exemplo n.º 2
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.
        }