public async Task TwoWay_Collection_Updates_After_ReplaceRange_One_Collection_Changes() { var dataContext = new VmWithRangeCollection <int>(); dataContext.List.AddRange(new[] { 100, 200 }); var test = new TestInContextAsync() { Bind = (win) => HtmlBinding.Bind(win, dataContext, JavascriptBindingMode.TwoWay), Test = async(mb) => { var js = mb.JsRootObject; await DoSafeAsyncUI(() => { dataContext.List.ReplaceRange(new[] { 1, 2, 3, 4, 5 }); }); var col = await GetCollectionAttributeAsync(js, "List"); col.Should().NotBeNull(); CheckIntCollection(col, new[] { 1, 2, 3, 4, 5 }); } }; await RunAsync(test); }
public async Task TwoWay_Collection_Updates_After_InsertRange_Changes() { var dataContext = new VmWithRangeCollection <int>(); dataContext.List.AddRange(new[] { 1, 4 }); var test = new TestInContextAsync() { Bind = (win) => HtmlBinding.Bind(win, dataContext, JavascriptBindingMode.TwoWay), Test = async(mb) => { var js = mb.JsRootObject; DoSafeUI(() => { dataContext.List.InsertRange(1, new[] { 2, 3 }); }); await Task.Delay(500); var col = GetCollectionAttribute(js, "List"); col.Should().NotBeNull(); CheckIntCollection(col, new[] { 1, 2, 3, 4 }); } }; await RunAsync(test); }
private static VmWithRangeCollection <BasicTestViewModel> BuildVmWithRangeCollection() { var root = new VmWithRangeCollection <BasicTestViewModel>(); root.List.AddRange(new[] { new BasicTestViewModel(), new BasicTestViewModel(), new BasicTestViewModel(), new BasicTestViewModel() }); return(root); }