public void LinkToWithExistingCondition() { var owner = new Mock <IOwnScheduleDefinitions>(); ScheduleElementId id = null; var scheduleBuilder = new Mock <IBuildFixedSchedules>(); { scheduleBuilder.Setup( s => s.LinkTo( It.IsAny <IScheduleVertex>(), It.IsAny <IScheduleVertex>(), It.IsAny <ScheduleElementId>())) .Callback <IScheduleVertex, IScheduleVertex, ScheduleElementId>( (s, e, c) => id = c); } var builder = new ScheduleDefinitionBuilder(owner.Object, scheduleBuilder.Object); var condition = new ScheduleConditionRegistrationId(typeof(string), 0, "a"); builder.LinkTo(new MarkHistoryVertex(0), new InsertVertex(1), condition); Assert.IsNotNull(id); var firstId = id; builder.LinkTo(new MarkHistoryVertex(2), new InsertVertex(3), condition); Assert.IsNotNull(id); Assert.AreSame(firstId, id); }
public void LinkToWithoutCondition() { var owner = new Mock <IOwnScheduleDefinitions>(); var scheduleBuilder = new Mock <IBuildFixedSchedules>(); { scheduleBuilder.Setup( s => s.LinkTo( It.IsAny <IScheduleVertex>(), It.IsAny <IScheduleVertex>(), It.IsAny <ScheduleElementId>())) .Callback <IScheduleVertex, IScheduleVertex, ScheduleElementId>( (s, e, c) => Assert.IsNull(c)); } var builder = new ScheduleDefinitionBuilder(owner.Object, scheduleBuilder.Object); var start = new MarkHistoryVertex(0); var end = new InsertVertex(1); builder.LinkTo(start, end); }
public void LinkToWithoutCondition() { var owner = new Mock<IOwnScheduleDefinitions>(); var scheduleBuilder = new Mock<IBuildFixedSchedules>(); { scheduleBuilder.Setup( s => s.LinkTo( It.IsAny<IScheduleVertex>(), It.IsAny<IScheduleVertex>(), It.IsAny<ScheduleElementId>())) .Callback<IScheduleVertex, IScheduleVertex, ScheduleElementId>( (s, e, c) => Assert.IsNull(c)); } var builder = new ScheduleDefinitionBuilder(owner.Object, scheduleBuilder.Object); var start = new MarkHistoryVertex(0); var end = new InsertVertex(1); builder.LinkTo(start, end); }
public void LinkToWithExistingCondition() { var owner = new Mock<IOwnScheduleDefinitions>(); ScheduleElementId id = null; var scheduleBuilder = new Mock<IBuildFixedSchedules>(); { scheduleBuilder.Setup( s => s.LinkTo( It.IsAny<IScheduleVertex>(), It.IsAny<IScheduleVertex>(), It.IsAny<ScheduleElementId>())) .Callback<IScheduleVertex, IScheduleVertex, ScheduleElementId>( (s, e, c) => id = c); } var builder = new ScheduleDefinitionBuilder(owner.Object, scheduleBuilder.Object); var condition = new ScheduleConditionRegistrationId(typeof(string), 0, "a"); builder.LinkTo(new MarkHistoryVertex(0), new InsertVertex(1), condition); Assert.IsNotNull(id); var firstId = id; builder.LinkTo(new MarkHistoryVertex(2), new InsertVertex(3), condition); Assert.IsNotNull(id); Assert.AreSame(firstId, id); }