Пример #1
0
        private void TestCollidingPlanes()
        {
            for (int i = 0; i < CurrentPlanes.Count; ++i)
            {
                for (int j = 0; j < CurrentPlanes.Count; ++j)
                {
                    if (i != j)
                    {
                        int deltaX   = CurrentPlanes[i].New.XPosition - CurrentPlanes[j].New.XPosition;
                        int deltaY   = CurrentPlanes[i].New.YPosition - CurrentPlanes[j].New.YPosition;
                        int deltaAlt = CurrentPlanes[i].New.Altitude - CurrentPlanes[j].New.Altitude;

                        if (Calculator.Calculator.AreColliding(deltaX, deltaY, deltaAlt))
                        {
                            Planes comPlanes = new Planes {
                                New = CurrentPlanes[i].New, Old = CurrentPlanes[j].New
                            };

                            if (!CollideTracker.Contains(comPlanes.GetHashCode()))
                            {
                                Event.CollidingPlanes.Add(comPlanes);
                                CollideTracker.Add(comPlanes.GetHashCode());
                                ColLog.LogPlanes(comPlanes);
                            }
                        }
                    }
                }
            }
        }
Пример #2
0
        public void TestWritingToFile(string planeID1, string planeID2, string result)
        {
            ClearFile();
            Plane p1 = new Plane {
                ID = planeID1, TimeStamp = DateTime.Now
            };
            Plane p2 = new Plane {
                ID = planeID2
            };

            Planes combined = new Planes {
                New = p1, Old = p2
            };

            uut.LogPlanes(combined);
            string[] outPut = File.ReadAllLines(Path + @"\LogFile.txt");


            string[] IDs = outPut[0].Split(';');

            Assert.That(IDs[0] + IDs[1], Is.EqualTo(result));
        }