예제 #1
0
        public void ControlExtension_OK()
        {
            using var tf = new TestForm();
            var tb = tf.AddControl <TextBox>(1, 1, 5, 5);

            tb.Name = "testTextBox";

            tf.Control("testTextBox", typeof(TextBox)).Should().NotBeNull();
            tf.Control("testTextBox", typeof(TextBox)).Should().HaveType <TextBox>();

            tf.Control <TextBox>("testTextBox").Should().NotBeNull();
            tf.Control <TextBox>("testTextBox").Should().HaveType <TextBox>();
        }
예제 #2
0
        public void ControlMatch_FailPredicate()
        {
            using var tf = new TestForm();
            var tb = tf.AddControl <TextBox>(1, 1, 5, 5);

            tb.Name = "testTextBox";

            tf.Should().HaveControl <TextBox>("testTextBox");

            ((Action)(() => tf.Control <TextBox>("testTextBox")
                      .Should().MatchAs <TextBox>(tb => tb.Name == "testTextBax"))).Should().Throw <XunitException>();
        }
예제 #3
0
        public void ControlMatch_OK()
        {
            using var tf = new TestForm();
            var tb = tf.AddControl <TextBox>(1, 1, 5, 5);

            tb.Name = "testTextBox";

            tf.Should().HaveControl <TextBox>("testTextBox");

            ((Action)(() => tf.Control <TextBox>("testTextBox")
                      .Should().MatchAs <TextBox>(tb => tb.Name == "testTextBox"))).Should().NotThrow();
        }