Exemplo n.º 1
0
        public void WhenCountdownIsTicked_AndNoRemainingTime_IfNullCallback_NoError()
        {
            MyCountdown systemUnderTest = new MyCountdown(Substitute.For <IBackendManager>(), 0, Substitute.For <ICountdownCallback>());

            systemUnderTest.RemainingTimeMs = 0;

            systemUnderTest.Tick(0);
        }
Exemplo n.º 2
0
        public void CountdownTicks_AsExpected(long i_remainingTimeMs, long i_tickTimeMs, long i_expectedRemainingTimeMs)
        {
            MyCountdown systemUnderTest = new MyCountdown(Substitute.For <IBackendManager>(), 0, Substitute.For <ICountdownCallback>());

            systemUnderTest.RemainingTimeMs = i_remainingTimeMs;

            systemUnderTest.Tick(i_tickTimeMs);

            Assert.AreEqual(i_expectedRemainingTimeMs, systemUnderTest.RemainingTimeMs);
        }
Exemplo n.º 3
0
        public void WhenCountdownIsTicked_AndRemainingTime_CallbackIsNotSent()
        {
            ICountdownCallback mockCallback    = Substitute.For <ICountdownCallback>();
            MyCountdown        systemUnderTest = new MyCountdown(Substitute.For <IBackendManager>(), 0, mockCallback);

            systemUnderTest.RemainingTimeMs = 100;

            systemUnderTest.Tick(0);

            mockCallback.DidNotReceive().SendCallback();
            Assert.AreEqual(mockCallback, systemUnderTest.Callback);
        }
Exemplo n.º 4
0
        public void WhenCountdownIsTicked_AndNoRemainingTime_CallbackIsSent_AndNulled()
        {
            ICountdownCallback mockCallback    = Substitute.For <ICountdownCallback>();
            MyCountdown        systemUnderTest = new MyCountdown(Substitute.For <IBackendManager>(), 0, mockCallback);

            systemUnderTest.RemainingTimeMs = 0;

            systemUnderTest.Tick(0);

            mockCallback.Received().SendCallback();
            Assert.IsNull(systemUnderTest.Callback);
        }