Exemplo n.º 1
0
 private DirectSsdWriter(ImmutableList <Pin> segmentPins, ImmutableList <Pin> digitPins,
                         StepApplier applier, Func <int, byte> values, ImmutableTimer timer,
                         int?currentDigit = null)
 {
     this.segmentPins  = segmentPins;
     this.digitPins    = digitPins;
     this.applier      = applier;
     this.values       = values;
     this.timer        = timer;
     this.currentDigit = currentDigit ?? digitPins.Count - 1;
 }
Exemplo n.º 2
0
        public void Remaining_BeforeStart_ReturnsInterval()
        {
            var timer = new ImmutableTimer(2).Tick(2);

            Assert.AreEqual(3, timer.Remaining(1));
        }
Exemplo n.º 3
0
        public void Remaining_WhenWrappingNext_ReturnsRemaining()
        {
            var timer = new ImmutableTimer(4).Tick(uint.MaxValue);

            Assert.AreEqual(2, timer.Remaining(1));
        }
Exemplo n.º 4
0
        public void Remaining_AfterExpectedEnd_ReturnsZero()
        {
            var timer = new ImmutableTimer(2).Tick(0);

            Assert.AreEqual(0, timer.Remaining(3));
        }
Exemplo n.º 5
0
        public void Remaining_AfterTicked_ReturnsRemaining()
        {
            var timer = new ImmutableTimer(2).Tick(0);

            Assert.AreEqual(1, timer.Remaining(1));
        }
Exemplo n.º 6
0
        public void Remaining_AtStart_ReturnsZero()
        {
            var timer = new ImmutableTimer(2);

            Assert.AreEqual(0, timer.Remaining(0));
        }
Exemplo n.º 7
0
        public void SetInterval_WhenTicked_UseNewInterval()
        {
            var timer = new ImmutableTimer(2).Tick(0).SetInterval(3);

            Assert.AreEqual(timer, timer.Tick(2));
        }
Exemplo n.º 8
0
        public void Tick_LargerThanInterval_ReturnsDifferentInstance()
        {
            var timer = new ImmutableTimer(2).Tick(0);

            Assert.AreNotEqual(timer, timer.Tick(2));
        }
Exemplo n.º 9
0
        public void Tick_SmallerThanInterval_ReturnsSameInstance()
        {
            var timer = new ImmutableTimer(2).Tick(0);

            Assert.AreEqual(timer, timer.Tick(1));
        }
Exemplo n.º 10
0
        public void Tick_AtStart_Triggers()
        {
            var timer = new ImmutableTimer(2);

            Assert.AreNotEqual(timer, timer.Tick(0));
        }