예제 #1
0
        public void TestBefore()
        {
            Assert.Throws <ArgumentOutOfRangeException>(() => ElectionLifecycleInfo.Before(ElectionState.PreNominations));

            Assert.AreEqual(ElectionState.PreNominations, ElectionLifecycleInfo.Before(ElectionState.Nominations));
            Assert.AreEqual(ElectionState.Nominations, ElectionLifecycleInfo.Before(ElectionState.PreVoting));
            Assert.AreEqual(ElectionState.PreVoting, ElectionLifecycleInfo.Before(ElectionState.Voting));
            Assert.AreEqual(ElectionState.Voting, ElectionLifecycleInfo.Before(ElectionState.Closed));
            Assert.AreEqual(ElectionState.Closed, ElectionLifecycleInfo.Before(ElectionState.ResultsPublished));

            Assert.Throws <ArgumentOutOfRangeException>(() => ElectionLifecycleInfo.Before(ElectionState.Disabled));
            Assert.Throws <ArgumentOutOfRangeException>(() => ElectionLifecycleInfo.Before(ElectionState.Aborted));
        }
        public override bool ShouldBeScheduled()
        {
            ElectionState intendedState = IsStart ? ElectionLifecycleInfo.Before(PhaseState) : PhaseState;

            return(Entity.State == intendedState);
        }