Exemplo n.º 1
0
        public Line(RailwayStation fromObj, RailwayStation toObj, string name, float distance)
        {
            Name = name;
            From = fromObj;
            To = toObj;

            _segmentFrom = new Segment(From, To, distance);
        }
Exemplo n.º 2
0
        public void AppendBeforeTest()
        {
            TrackObject beginStation = new RailwayStation("Begin");
            TrackObject endStation = new RailwayStation("End");
            TrackObject newBegin = new RailwayStation("NewBegin");

            Segment source = new Segment(beginStation, endStation, 10);

            Segment appended = source.Insert(endStation, newBegin, 25);

            Assert.AreEqual(appended.From, newBegin);
            Assert.AreEqual(appended.To, beginStation);
            Assert.AreEqual(appended.Distance, 15);

            Assert.AreEqual(appended.Next, source);
            Assert.AreEqual(appended.Prev, null);

            Assert.AreEqual(source.Prev, appended);
            Assert.AreEqual(source.Next, null);
        }
Exemplo n.º 3
0
        public void SetUp()
        {
            _st1 = new RailwayStation("St_1");
            _st2 = new RailwayStation("St_2");
            _st3 = new RailwayStation("St_3");

            _seg1 = new Segment(_st1, _st2, 15);
            _seg2 = _seg1.Insert(_st1, _st3, 40);
        }
Exemplo n.º 4
0
        public void InsertSimpleFromLastTest()
        {
            TrackObject beginStation = new RailwayStation("Begin");
            TrackObject endStation = new RailwayStation("End");
            TrackObject middleStation = new RailwayStation("Middle");

            Segment originSegment = new Segment(beginStation, endStation, 20);

            Segment inserted = originSegment.Insert(endStation, middleStation, 5);

            Assert.AreEqual(inserted.From, middleStation);
            Assert.AreEqual(inserted.To, endStation);
            Assert.AreEqual(inserted.Distance, 5);

            Assert.AreEqual(originSegment.From, beginStation);
            Assert.AreEqual(originSegment.To, middleStation);
            Assert.AreEqual(originSegment.Distance, 15);

            Assert.AreEqual(inserted.Prev, originSegment);
            Assert.AreEqual(inserted.Next, null);

            Assert.AreEqual(originSegment.Prev, null);
            Assert.AreEqual(originSegment.Next, inserted);
        }