public void AddSynchronizationEndPointWithMissingStartPoint()
        {
            var variable = new Mock <IScheduleVariable>();

            var builder = new FixedScheduleBuilder();

            Assert.Throws <UnknownScheduleVertexException>(
                () => builder.AddSynchronizationEnd(
                    new SynchronizationStartVertex(
                        10,
                        new[]
            {
                variable.Object
            })));
        }
        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 AddSynchronizationEndPointWithMissingStartPoint()
        {
            var variable = new Mock<IScheduleVariable>();

            var builder = new FixedScheduleBuilder();
            Assert.Throws<UnknownScheduleVertexException>(
                () => builder.AddSynchronizationEnd(
                    new SynchronizationStartVertex(
                        10,
                        new[]
                            {
                                variable.Object
                            })));
        }
        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)));
        }