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); }
public async void OnStringAction() { var counter = 0; _builder.On("click", () => counter++); await _root.NotifyEvent("click"); Assert.Equal(1, counter); }
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); }