예제 #1
0
        public void _02_Creer_une_classe_TodoState_avec_une_methode_Start_et_Close()
        {
            Task task = new Task();

            TodoState state = new TodoState();

            Assert.Equal("TODO -> IN PROGRESS", state.Start(task));
            Assert.Equal("INVALID TRANSITION", state.Close(task));
        }
예제 #2
0
        public void _05_Creer_une_interface_ITaskState_avec_une_methode_Start_et_Close_pour_unifier_TodoState_et_InProgressState_et_ClosedState()
        {
            Task task = new Task();

            ITaskState todoState = new TodoState();

            Assert.Equal("TODO -> IN PROGRESS", todoState.Start(task));
            Assert.Equal("INVALID TRANSITION", todoState.Close(task));

            ITaskState inProgressState = new InProgressState();

            Assert.Equal("INVALID TRANSITION", inProgressState.Start(task));
            Assert.Equal("IN PROGRESS -> CLOSED", inProgressState.Close(task));

            ITaskState closedState = new ClosedState();

            Assert.Equal("INVALID TRANSITION", closedState.Start(task));
            Assert.Equal("INVALID TRANSITION", closedState.Close(task));
        }