public void LeavingAnActionRemovesItselfFromListPassedInCtor() { // given var actions = new SynchronizedQueue <IAction>(); var target = new Action(logger, beacon, "test", actions); // when leaving the action target.LeaveAction(); // then Assert.That(actions.IsEmpty, Is.True); }
internal Action(Beacon beacon, string name, Action parentAction, SynchronizedQueue <IAction> thisLevelActions) { this.beacon = beacon; this.parentAction = parentAction; this.startTime = beacon.CurrentTimestamp; this.startSequenceNo = beacon.NextSequenceNumber; this.id = beacon.NextID; this.name = name; this.thisLevelActions = thisLevelActions; this.thisLevelActions.Put(this); }
public void AnActionAddsItselfIntoListInContstructor() { // given var actions = new SynchronizedQueue <IAction>(); // when constructing the action var target = new Action(logger, beacon, "test", actions); // then Assert.That(actions.IsEmpty, Is.False); Assert.That(actions.ToList(), Is.EqualTo(new List <Action> { target })); }
public void DisposingAnActionLeavesTheAction() { // given var actions = new SynchronizedQueue <IAction>(); mockTimingProvider.ProvideTimestampInMilliseconds().Returns(123L, 321L, 322L, 323L); IDisposable target = new Action(logger, beacon, "test", actions); while (beacon.NextSequenceNumber < 41) { ; // increase the sequence number } // when disposing the target target.Dispose(); // then Assert.That(actions.IsEmpty, Is.True); Assert.That(((Action)target).EndSequenceNo, Is.EqualTo(42)); Assert.That(((Action)target).EndTime, Is.EqualTo(322L)); }
// *** constructors *** public RootAction(ILogger logger, Beacon beacon, string name, SynchronizedQueue <IAction> thisLevelActions) : base(logger, beacon, name, thisLevelActions) { this.beacon = beacon; }
public Action(ILogger logger, Beacon beacon, string name, SynchronizedQueue <IAction> thisLevelActions) : this(logger, beacon, name, null, thisLevelActions) { }
// *** constructors *** public Action(Beacon beacon, string name, SynchronizedQueue <IAction> parentActions) : this(beacon, name, null, parentActions) { }
public Action(Beacon beacon, string name, SynchronizedQueue <IAction> thisLevelActions) : this(beacon, name, null, thisLevelActions) { }