public async Task DrawerHost_CancelingClosingEvent_DrawerStaysOpen() { await using var recorder = new TestRecorder(App); IVisualElement <DrawerHost> drawerHost = (await LoadUserControl <CancellingDrawerHost>()).As <DrawerHost>(); var showButton = await drawerHost.GetElement <Button>("ShowButton"); var closeButton = await drawerHost.GetElement <Button>("CloseButton"); var closeButtonDp = await drawerHost.GetElement <Button>("CloseButtonDp"); var openedEvent = await drawerHost.RegisterForEvent(nameof(DrawerHost.DrawerOpened)); await showButton.LeftClick(); //Allow open animation to finish await Task.Delay(300); await Wait.For(async() => (await openedEvent.GetInvocations()).Count == 1); var closingEvent = await drawerHost.RegisterForEvent(nameof(DrawerHost.DrawerClosing)); //Attempt closing with routed command await closeButton.LeftClick(); await Task.Delay(100); await Wait.For(async() => (await closingEvent.GetInvocations()).Count == 1); Assert.True(await drawerHost.GetIsLeftDrawerOpen()); //Attempt closing with click away await drawerHost.LeftClick(); await Task.Delay(100); await Wait.For(async() => (await closingEvent.GetInvocations()).Count == 2); Assert.True(await drawerHost.GetIsLeftDrawerOpen()); //Attempt closing with DP property toggle await closeButtonDp.LeftClick(); await Task.Delay(100); await Wait.For(async() => (await closingEvent.GetInvocations()).Count == 3); Assert.True(await drawerHost.GetIsLeftDrawerOpen()); recorder.Success(); }