Esempio n. 1
0
        public async Task OnGetTypedElement_GetsTypedElement()
        {
            // Arrange
            await using TestRecorder recorder = new(App);

            await Window.SetXamlContent(@"
<Grid>
  <Button x:Name=""MyButton"" IsDefault=""True"" VerticalAlignment=""Center"" HorizontalAlignment=""Center"" />
</Grid>");

            //Act
            IVisualElement <Button> button = await Window.GetElement <Button>("MyButton");

            //Assert
            Assert.IsNotNull(button);

            Assert.IsTrue(await button.GetActualWidth() > 0);
            Assert.IsTrue(await button.GetIsDefault());
            Assert.IsFalse(await button.GetIsPressed());
            recorder.Success();
        }