public void ErrorStateTest()
 {
     ReportStart();
     foreach (ErrorState state in ErrorState.GetValues(typeof(ErrorState)))
     {
         _status = new GifComponentStatus(state, "error");
         Assert.AreEqual(state, _status.ErrorState);
     }
     ReportEnd();
 }
Example #2
0
        public void TestStateTest()
        {
            ReportStart();

            Assert.IsTrue(_component.TestState(_componentState));
            Assert.IsTrue(_component.TestState(_sub1State));
            Assert.IsTrue(_component.TestState(_sub2State));
            Assert.IsTrue(_component.TestState(_sub3State));
            Assert.IsTrue(_component.SubComponent1.TestState(_sub1State));
            Assert.IsTrue(_component.SubComponents[0].TestState(_sub2State));
            Assert.IsTrue(_component.SubComponents[1].TestState(_sub3State));

            Array possibleStates = ErrorState.GetValues(typeof(ErrorState));

            foreach (ErrorState thisState in possibleStates)
            {
                if (thisState != ErrorState.Ok &&
                    thisState != _sub1State
                    )
                {
                    Assert.IsFalse(_component.SubComponent1.TestState(thisState),
                                   thisState.ToString());
                }
            }

            foreach (ErrorState thisState in possibleStates)
            {
                if (thisState != ErrorState.Ok &&
                    thisState != _sub2State
                    )
                {
                    Assert.IsFalse(_component.SubComponents[0].TestState(thisState),
                                   thisState.ToString());
                }
            }

            foreach (ErrorState thisState in possibleStates)
            {
                if (thisState != ErrorState.Ok &&
                    thisState != _sub3State
                    )
                {
                    Assert.IsFalse(_component.SubComponents[1].TestState(thisState),
                                   thisState.ToString());
                }
            }

            foreach (ErrorState thisState in possibleStates)
            {
                if (thisState != ErrorState.Ok &&
                    thisState != _sub1State &&
                    thisState != _sub2State &&
                    thisState != _sub3State &&
                    thisState != _componentState
                    )
                {
                    Assert.IsFalse(_component.TestState(thisState),
                                   thisState.ToString());
                }
            }

            ReportEnd();
        }