예제 #1
0
        public void Handle_WhenNull_WhenNoAbsent_NothingDone()
        {
            var handlePresent = new MockAction <string>();
            var option        = Optional <string> .Of(null);

            option.Handle(value => handlePresent.Run(value));

            handlePresent.VerifyActionNotCalled();
        }
예제 #2
0
        public void Handle_WhenPresent_RunPresentAction()
        {
            var handlePresent = new MockAction <string>();
            var handleAbsent  = new MockAction();
            var option        = Optional <string> .Of("present");

            option.Handle(value => handlePresent.Run(value), () => handleAbsent.Run());

            handlePresent.VerifyActionCalled("present");
            handleAbsent.VerifyActionNotCalled();
        }
예제 #3
0
        public void SwitchPlayer_VerifyActionNotCalled()
        {
            var action = new MockAction();
            var state  = CHECK_FOR_WIN();

            StateTests <IGameState>
            .For(state)
            .When(() => state.SwitchPlayer(() => action.Run()))
            .Invoke();

            action.VerifyActionNotCalled();
        }
예제 #4
0
        public void Play_VerifyActionNotCalled()
        {
            var action = new MockAction();
            var state  = SWITCH_PLAYER();

            StateTests <IGameState>
            .For(state)
            .When(() => state.Play(() => action.Run()))
            .Invoke();

            action.VerifyActionNotCalled();
        }