Inheritance: IReadOnlyBooleanState
コード例 #1
0
 public IReadOnlyBooleanState Exists()
 {
     const string unexpectedlyFalse = "{0} does not exist but should.";
     const string unexpectedlyTrue = "{0} exists but should not.";
     string unexpectedlyTrueMessage = String.Format(unexpectedlyTrue, HowFound);
     string unexpectedlyFalseMessage = String.Format(unexpectedlyFalse, HowFound);
     var result = new BooleanState(unexpectedlyFalseMessage,
                                   unexpectedlyTrueMessage,
                                   () => Element.Exists);
     return result;
 }
コード例 #2
0
 public IReadOnlyBooleanState Contains([NotNull] string containedText)
 {
     const string unexpectedlyTrue = "The text '{0}' in {1} should not start with '{2}'";
     const string unexpectedlyFalse = "The text '{0}' in {1} should start with '{2}'";
     string unexpectedlyFalseMessage = String.Format(unexpectedlyFalse, Text, _howFound, containedText);
     string unexpectedlyTrueMessage = String.Format(unexpectedlyTrue, Text, _howFound, containedText);
     var result = new BooleanState(unexpectedlyFalseMessage,
                                   unexpectedlyTrueMessage,
                                   () => Text.Contains(containedText));
     return result;
 }
コード例 #3
0
 public IReadOnlyBooleanState Enabled()
 {
     const string unexpectedlyFalse = "{0} is not enabled but should be.";
     const string unexpectedlyTrue = "{0} is enabled but should not be.";
     string unexpectedlyTrueMessage = String.Format(unexpectedlyTrue, HowFound);
     string unexpectedlyFalseMessage = String.Format(unexpectedlyFalse, HowFound);
     var result = new BooleanState(unexpectedlyFalseMessage,
                                   unexpectedlyTrueMessage,
                                   () => Element.Enabled);
     return result;
 }
コード例 #4
0
        public IReadOnlyBooleanState Visible()
        {
            const string unexpectedlyFalse = "{0} should be visible but is not because {1} is marked display: none .";
            const string unexpectedlyTrue = "{0} should not be visible but is.";
            var visibility = IsDisplayed(Element);
            string parent;
            if (visibility.Value != null)
            {
                parent = "its parent tag " + visibility.Value;
            }
            else
            {
                parent = "it";
            }
            string unexpectedlyTrueMessage = String.Format(unexpectedlyTrue, HowFound);
            string unexpectedlyFalseMessage = String.Format(unexpectedlyFalse, HowFound, parent);

            var result = new BooleanState(unexpectedlyFalseMessage,
                                          unexpectedlyTrueMessage,
                                          () => visibility.Key);
            return result;
        }
コード例 #5
0
 public IReadOnlyBooleanState StartsWith([NotNull] string startingText)
 {
     const string unexpectedlyTrue = "The text '{0}' in {1} should not contain '{2}'";
     const string unexpectedlyFalse = "The text '{0}' in {1} should contain '{2}'";
     var unexpectedlyTrueMessage = String.Format(unexpectedlyTrue, Text, _howFound, startingText);
     var unexpectedlyFalseMessage = String.Format(unexpectedlyFalse, Text, _howFound, startingText);
     var result = new BooleanState(unexpectedlyFalseMessage,
                                   unexpectedlyTrueMessage,
                                   () => Text.StartsWith(startingText));
     return result;
 }