예제 #1
0
        public void throws_exception_if_argument_is_invalid_type()
        {
            var dummyCommand    = new Mock <ICommand <EmptyArgument> >().Object;
            var invalidArgument = "string is not a valid command type";

            var sut = new DefaultCommandExecutor();

            Assert.Throws <NotSupportedException>(() => sut.Execute(dummyCommand, invalidArgument));
        }
예제 #2
0
        public void throws_exception_if_command_is_invalid_type()
        {
            var invalidCommand = "string is not a valid command type";
            var dummyArgument  = new EmptyArgument();

            var sut = new DefaultCommandExecutor();

            Assert.Throws <NotSupportedException>(() => sut.Execute(invalidCommand, dummyArgument));
        }
예제 #3
0
        public void invokes_execute_method()
        {
            var mock          = new Mock <ICommand <EmptyArgument> >();
            var dummyArgument = new EmptyArgument();
            var sut           = new DefaultCommandExecutor();

            sut.Execute(mock.Object, dummyArgument);

            mock.Verify(x => x.Execute(dummyArgument));
        }
예제 #4
0
        public void invokes_expected_method_when_overloads_exists()
        {
            var spy = new SpyOverloadExecuteMethodCommand();

            var sut = new DefaultCommandExecutor();

            sut.Execute(spy, new EmptyArgument());

            Assert.True(spy.wasExpectedInvoked);
        }