Beispiel #1
0
        public async Task TwoWay_Updates_Collection()
        {
            var datacontext = new ChangingCollectionViewModel();

            var test = new TestInContextAsync()
            {
                Bind = (win) => HtmlBinding.Bind(win, datacontext, JavascriptBindingMode.TwoWay),
                Test = async(mb) =>
                {
                    var js = mb.JsRootObject;

                    var col = await GetCollectionAttributeAsync(js, "Items");

                    col.GetArrayLength().Should().NotBe(0);

                    await DoSafeAsyncUIFullCycle(() => datacontext.Replace.Execute(null));

                    datacontext.Items.Should().BeEmpty();

                    col = await GetCollectionAttributeAsync(js, "Items");

                    col.GetArrayLength().Should().Be(0);
                }
            };

            await RunAsync(test);
        }
Beispiel #2
0
 public MainWindow()
 {
     InitializeComponent();
     DataContext = new ChangingCollectionViewModel();
 }