public void InsertInWithUnknownInsertVertex() { var builder = new FixedScheduleBuilder(); var markHistoryVertex = builder.AddHistoryMarkingPoint(); Assert.Throws <UnknownScheduleVertexException>( () => builder.InsertIn(new InsertVertex(10), markHistoryVertex)); }
public void InsertInWithKnownVertexToInsert() { var builder = new FixedScheduleBuilder(); var insertVertex = builder.AddInsertPoint(); var markHistoryVertex = builder.AddHistoryMarkingPoint(); Assert.Throws <CannotInsertExistingVertexException>( () => builder.InsertIn(insertVertex, markHistoryVertex)); }
public void InsertInWithNoMoreRemainingInserts() { var builder = new FixedScheduleBuilder(); var insertVertex = builder.AddInsertPoint(1); builder.LinkFromStart(insertVertex); builder.LinkToEnd(insertVertex); var markHistoryVertex1 = new MarkHistoryVertex(10); var newInserts = builder.InsertIn(insertVertex, markHistoryVertex1); Assert.IsNull(newInserts.Item1); Assert.IsNull(newInserts.Item2); }
public void InsertInWithSubSchedule() { var conditionId1 = new ScheduleElementId(); var conditionId2 = new ScheduleElementId(); var builder = new FixedScheduleBuilder(); var insertVertex = builder.AddInsertPoint(); builder.LinkFromStart(insertVertex, conditionId1); builder.LinkToEnd(insertVertex, conditionId2); var scheduleId = new ScheduleId(); builder.InsertIn(insertVertex, scheduleId); var schedule = builder.Build(); int index = 0; var vertexTypes = new List <Type> { typeof(StartVertex), typeof(InsertVertex), typeof(SubScheduleVertex), typeof(InsertVertex), typeof(EndVertex) }; var conditions = new List <ScheduleElementId> { conditionId1, null, null, conditionId2 }; schedule.TraverseAllScheduleVertices( schedule.Start, (vertex, edges) => { Assert.AreEqual(vertexTypes[index], vertex.GetType()); if (index < conditions.Count) { Assert.AreEqual(1, edges.Count()); Assert.AreEqual(conditions[index], edges.First().Item1); } index++; return(true); }); }
public void InsertInWithUnknownInsertVertex() { var builder = new FixedScheduleBuilder(); var markHistoryVertex = builder.AddHistoryMarkingPoint(); Assert.Throws<UnknownScheduleVertexException>( () => builder.InsertIn(new InsertVertex(10), markHistoryVertex)); }
public void InsertInWithSubSchedule() { var conditionId1 = new ScheduleElementId(); var conditionId2 = new ScheduleElementId(); var builder = new FixedScheduleBuilder(); var insertVertex = builder.AddInsertPoint(); builder.LinkFromStart(insertVertex, conditionId1); builder.LinkToEnd(insertVertex, conditionId2); var scheduleId = new ScheduleId(); builder.InsertIn(insertVertex, scheduleId); var schedule = builder.Build(); int index = 0; var vertexTypes = new List<Type> { typeof(StartVertex), typeof(InsertVertex), typeof(SubScheduleVertex), typeof(InsertVertex), typeof(EndVertex) }; var conditions = new List<ScheduleElementId> { conditionId1, null, null, conditionId2 }; schedule.TraverseAllScheduleVertices( schedule.Start, (vertex, edges) => { Assert.AreEqual(vertexTypes[index], vertex.GetType()); if (index < conditions.Count) { Assert.AreEqual(1, edges.Count()); Assert.AreEqual(conditions[index], edges.First().Item1); } index++; return true; }); }
public void InsertInWithNoMoreRemainingInserts() { var builder = new FixedScheduleBuilder(); var insertVertex = builder.AddInsertPoint(1); builder.LinkFromStart(insertVertex); builder.LinkToEnd(insertVertex); var markHistoryVertex1 = new MarkHistoryVertex(10); var newInserts = builder.InsertIn(insertVertex, markHistoryVertex1); Assert.IsNull(newInserts.Item1); Assert.IsNull(newInserts.Item2); }
public void InsertInWithKnownVertexToInsert() { var builder = new FixedScheduleBuilder(); var insertVertex = builder.AddInsertPoint(); var markHistoryVertex = builder.AddHistoryMarkingPoint(); Assert.Throws<CannotInsertExistingVertexException>( () => builder.InsertIn(insertVertex, markHistoryVertex)); }