Ejemplo n.º 1
0
        public void RelayCommandWithValidExecute_ExecuteWithNullParameter_Executes()
        {
            var executed = false;
            var command  = TestCommand.CreateWithExecute(_ => executed = true);

            command.Execute(null);

            Assert.True(executed);
        }
Ejemplo n.º 2
0
        public void RelayCommandWithValidExecute_ExecuteWithParameter_Executes()
        {
            var parameter = 5;
            var command   = TestCommand.CreateWithExecute(p =>
            {
                int passedParamter = (int)p;
                parameter          = ++passedParamter;
            });

            command.Execute(parameter);

            Assert.Equal(6, parameter);
        }
Ejemplo n.º 3
0
        public void RelayCommandWithNullExecuteAndDefaultCanExecute_CanExecuteWithParameter_CanExecuteReturnsTrue()
        {
            var command = TestCommand.CreateWithExecute(null);

            Assert.True(command.CanExecute(new object()));
        }
Ejemplo n.º 4
0
        public void RelayCommandWithNullExecute_ExecuteWithNullParamter_ThrowsNullReferenceException()
        {
            var command = TestCommand.CreateWithExecute(null);

            Assert.Throws <NullReferenceException>(() => command.Execute(null));
        }