public void AddSynchronizationStartPointWithoutVariables()
        {
            var builder = new FixedScheduleBuilder();

            Assert.Throws <CannotCreateASynchronizationBlockWithoutVariablesException>(
                () => builder.AddSynchronizationStart(new IScheduleVariable[] { }));
        }
        public void AddSynchronizationStartPoint()
        {
            var variable = new Mock <IScheduleVariable>();

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

            builder.LinkFromStart(synchronizationVertex);
            builder.LinkToEnd(synchronizationVertex);
            Assert.That(synchronizationVertex.VariablesToSynchronizeOn, Is.EquivalentTo(new[] { variable.Object }));
            Assert.AreEqual(2, synchronizationVertex.Index);

            var schedule = builder.Build();

            Assert.AreEqual(3, schedule.Vertices.Count());
            Assert.IsTrue(AreVerticesEqual(schedule.Start, schedule.Vertices.ElementAt(0)));
            Assert.IsTrue(AreVerticesEqual(synchronizationVertex, schedule.Vertices.ElementAt(1)));
            Assert.IsTrue(AreVerticesEqual(schedule.End, schedule.Vertices.ElementAt(2)));
        }
 public void AddSynchronizationStartPointWithoutVariables()
 {
     var builder = new FixedScheduleBuilder();
     Assert.Throws<CannotCreateASynchronizationBlockWithoutVariablesException>(
         () => builder.AddSynchronizationStart(new IScheduleVariable[] { }));
 }
        public void AddSynchronizationStartPoint()
        {
            var variable = new Mock<IScheduleVariable>();

            var builder = new FixedScheduleBuilder();
            var synchronizationVertex = builder.AddSynchronizationStart(new[] { variable.Object });
            builder.LinkFromStart(synchronizationVertex);
            builder.LinkToEnd(synchronizationVertex);
            Assert.That(synchronizationVertex.VariablesToSynchronizeOn, Is.EquivalentTo(new[] { variable.Object }));
            Assert.AreEqual(2, synchronizationVertex.Index);

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