示例#1
0
        public void ClickWithEventCallback()
        {
            // setup
            var  button  = new MockButton();
            bool clicked = false;

            // test
            button.Clicked = callbackFactory.Create(this, () => { clicked = true; });
            button.Click();

            // validate
            Assert.True(clicked);
        }
示例#2
0
        public void ClickWithCommand()
        {
            // setup
            var    button = new MockButton();
            string result = null;

            button.Command          = new TestCommand(p => result = p);
            button.CommandParameter = "foo";

            // test
            button.Click();

            // validate
            Assert.NotNull(result);
            Assert.Equal("foo", result);
        }
示例#3
0
        public async Task ClickWithCommand()
        {
            // setup
            var    button = new MockButton();
            string result = null;

            button.Command          = new TestCommand(p => result = p);
            button.CommandParameter = new TestCommandParameter {
                Message = "foo"
            };

            // test
            await button.Click();

            // validate
            Assert.NotNull(result);
            Assert.Equal("foo", result);
        }