Exemple #1
0
        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);
        }
Exemple #2
0
        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);
        }
Exemple #3
0
        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
            }));
        }
Exemple #4
0
        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));
        }
Exemple #5
0
        // *** constructors ***

        public RootAction(ILogger logger, Beacon beacon, string name, SynchronizedQueue <IAction> thisLevelActions)
            : base(logger, beacon, name, thisLevelActions)
        {
            this.beacon = beacon;
        }
Exemple #6
0
 public Action(ILogger logger, Beacon beacon, string name, SynchronizedQueue <IAction> thisLevelActions) : this(logger, beacon, name, null, thisLevelActions)
 {
 }
Exemple #7
0
        // *** constructors ***

        public Action(Beacon beacon, string name, SynchronizedQueue <IAction> parentActions) : this(beacon, name, null, parentActions)
        {
        }
Exemple #8
0
 public Action(Beacon beacon, string name, SynchronizedQueue <IAction> thisLevelActions) : this(beacon, name, null, thisLevelActions)
 {
 }