Exemplo n.º 1
0
        public RobotsBuilder ForUserAgent(string userAgent)
        {
            _lastUserAgent = new UserAgentEntry {UserAgent = userAgent};

            _robots.AddEntry(_lastUserAgent);

            return this;
        }
Exemplo n.º 2
0
 public void CommentTest()
 {
     Entry target = new UserAgentEntry(); // TODO: Initialize to an appropriate value
     const string expected = "comment";
     target.Comment = expected;
     string actual = target.Comment;
     Assert.Equal(expected, actual);
 }
Exemplo n.º 3
0
 public void Add_comment_Test()
 {
     var target = new UserAgentEntry();
     Entry entry = new CommentEntry();
     target.AddEntry(entry);
     Assert.NotEmpty(target.Entries);
     Assert.Empty(target.AllowEntries);
     Assert.Empty(target.DisallowEntries);
 }
Exemplo n.º 4
0
 public void AllowEntriesTest()
 {
     var target = new UserAgentEntry();
     Assert.Empty(target.AllowEntries);
 }
Exemplo n.º 5
0
 public void EntryType_Test()
 {
     var target = new UserAgentEntry();
     Assert.Equal(EntryType.UserAgent, target.Type);
 }
Exemplo n.º 6
0
        private bool CheckExplicitlyAllowed(UserAgentEntry userAgentEntry, Uri uri)
        {
            //if (!IsInternalToDomain(uri))
            //    return true;

            string[] uriParts = uri.PathAndQuery.Split(new[] {'/', '?'}, StringSplitOptions.RemoveEmptyEntries);
            foreach (var allowEntry in userAgentEntry.AllowEntries)
            {
                bool result;
                if (CheckAllowedEntry(allowEntry, uriParts, out result))
                {
                    return result;
                }
            }

            return false;
        }
Exemplo n.º 7
0
 public void HasCommentTest2()
 {
     Entry target = new UserAgentEntry {Comment = "comment"};
     bool actual = target.HasComment;
     Assert.Equal(true, actual);
 }
Exemplo n.º 8
0
 public void HasCommentTest()
 {
     Entry target = new UserAgentEntry(); // TODO: Initialize to an appropriate value
     bool actual = target.HasComment;
     Assert.Equal(false, actual);
 }