Ejemplo n.º 1
0
        public void LinkToWithStartAndEndEqual()
        {
            var builder      = new FixedScheduleBuilder();
            var insertVertex = builder.AddInsertPoint();

            Assert.Throws <CannotLinkAVertexToItselfException>(() => builder.LinkTo(insertVertex, insertVertex));
        }
Ejemplo n.º 2
0
        public void LinkToWithUnknownEnd()
        {
            var builder      = new FixedScheduleBuilder();
            var insertVertex = builder.AddInsertPoint();
            var otherVertex  = new InsertVertex(10);

            Assert.Throws <UnknownScheduleVertexException>(() => builder.LinkTo(insertVertex, otherVertex));
        }
Ejemplo n.º 3
0
        public void AddSynchronizationEndPoint()
        {
            var variable = new Mock <IScheduleVariable>();

            var builder = new FixedScheduleBuilder();
            var synchronizationStartVertex = builder.AddSynchronizationStart(new[] { variable.Object });

            builder.LinkFromStart(synchronizationStartVertex);

            var synchronizationEndVertex = builder.AddSynchronizationEnd(synchronizationStartVertex);

            builder.LinkTo(synchronizationStartVertex, synchronizationEndVertex);
            builder.LinkToEnd(synchronizationEndVertex);
            Assert.AreEqual(3, synchronizationEndVertex.Index);

            var schedule = builder.Build();

            Assert.AreEqual(4, schedule.Vertices.Count());
            Assert.IsTrue(AreVerticesEqual(schedule.Start, schedule.Vertices.ElementAt(0)));
            Assert.IsTrue(AreVerticesEqual(synchronizationStartVertex, schedule.Vertices.ElementAt(1)));
            Assert.IsTrue(AreVerticesEqual(synchronizationEndVertex, schedule.Vertices.ElementAt(2)));
            Assert.IsTrue(AreVerticesEqual(schedule.End, schedule.Vertices.ElementAt(3)));
        }
 public void LinkToWithUnknownStart()
 {
     var builder = new FixedScheduleBuilder();
     var insertVertex = builder.AddInsertPoint();
     var otherVertex = new InsertVertex(10);
     Assert.Throws<UnknownScheduleVertexException>(() => builder.LinkTo(otherVertex, insertVertex));
 }
 public void LinkToWithStartAndEndEqual()
 {
     var builder = new FixedScheduleBuilder();
     var insertVertex = builder.AddInsertPoint();
     Assert.Throws<CannotLinkAVertexToItselfException>(() => builder.LinkTo(insertVertex, insertVertex));
 }
        public void AddSynchronizationEndPoint()
        {
            var variable = new Mock<IScheduleVariable>();

            var builder = new FixedScheduleBuilder();
            var synchronizationStartVertex = builder.AddSynchronizationStart(new[] { variable.Object });
            builder.LinkFromStart(synchronizationStartVertex);

            var synchronizationEndVertex = builder.AddSynchronizationEnd(synchronizationStartVertex);
            builder.LinkTo(synchronizationStartVertex, synchronizationEndVertex);
            builder.LinkToEnd(synchronizationEndVertex);
            Assert.AreEqual(3, synchronizationEndVertex.Index);

            var schedule = builder.Build();
            Assert.AreEqual(4, schedule.Vertices.Count());
            Assert.IsTrue(AreVerticesEqual(schedule.Start, schedule.Vertices.ElementAt(0)));
            Assert.IsTrue(AreVerticesEqual(synchronizationStartVertex, schedule.Vertices.ElementAt(1)));
            Assert.IsTrue(AreVerticesEqual(synchronizationEndVertex, schedule.Vertices.ElementAt(2)));
            Assert.IsTrue(AreVerticesEqual(schedule.End, schedule.Vertices.ElementAt(3)));
        }