コード例 #1
0
ファイル: BuilderTesting.cs プロジェクト: rChavz/lara
        public async void OnEvent()
        {
            var executed = false;
            var root     = Element.Create("div");
            var builder  = new LaraBuilder(root);

            builder.On(new EventSettings
            {
                EventName = "click",
                Handler   = () =>
                {
                    executed = true;
                    return(Task.CompletedTask);
                }
            });

            /*var connection = new Connection(Guid.NewGuid(), IPAddress.Loopback);
             * var http = new Mock<HttpContext>();
             * var mock = new Mock<IPage>();
             * var context = new PageContext(_context.Application,
             *  http.Object, connection);*/
            await root.NotifyEvent("click");

            Assert.True(executed);
        }
コード例 #2
0
        public async void OnStringAction()
        {
            var counter = 0;

            _builder.On("click", () => counter++);
            await _root.NotifyEvent("click");

            Assert.Equal(1, counter);
        }
コード例 #3
0
        public async void OnEventSimple()
        {
            var executed = false;
            var root     = Element.Create("div");
            var builder  = new LaraBuilder(root);

            builder.On("click", () =>
            {
                executed = true;
                return(Task.CompletedTask);
            });
            await root.NotifyEvent("click");

            Assert.True(executed);
        }