Exemplo n.º 1
0
            private void ShouldAllowAllRoutesIfDisallowNotSet()
            {
                var userAgentRecord = new UserAgentRecord();

                var record = userAgentRecord.ToString();

                record.Should().Contain("Disallow:").And.NotContain("Disallow: /");
            }
Exemplo n.º 2
0
            private void ShouldSetCorrectUserAgent(string userAgent)
            {
                var userAgentRecord = new UserAgentRecord
                {
                    UserAgent = userAgent
                };

                var record = userAgentRecord.ToString();

                record.Should().Contain($"User-agent: {userAgent}");
            }
Exemplo n.º 3
0
            private void ShouldContainNoindexDirectiveIfDefinedForUrl()
            {
                var userAgentRecord = new UserAgentRecord
                {
                    NoIndex = new List <string> {
                        "/test", "/foo"
                    }
                };

                var record = userAgentRecord.ToString();

                record.Should().Contain("Noindex: /test").And.Contain("Noindex: /foo");
            }
Exemplo n.º 4
0
            private void ShouldBlockRoutesDefinedInDisallow()
            {
                var userAgentRecord = new UserAgentRecord
                {
                    Disallow = new List <string> {
                        "/test", "/foo"
                    }
                };

                var record = userAgentRecord.ToString();

                record.Should().Contain("Disallow: /test").And.Contain("Disallow: /foo");
            }
            private void ShouldAllowSiteWideAccessInProduction(string environmentName, bool expected)
            {
                var hostingEnvironment = new TestHostingEnvironment
                {
                    EnvironmentName = environmentName
                };
                var options = new SeoOptions();

                DefaultOptions.Configure(options, hostingEnvironment);

                UserAgentRecord userAgentRecord = options.RobotsTxt.UserAgentRecords.Single();

                userAgentRecord.DisallowAll.Should().Be(expected);
            }
Exemplo n.º 6
0
            private void ShouldBlockAllRoutesIfDisallowAllTrue()
            {
                var userAgentRecord = new UserAgentRecord
                {
                    DisallowAll = true,
                    Disallow    = new List <string> {
                        "/test"
                    }
                };

                var record = userAgentRecord.ToString();

                record.Should().Contain("Disallow: /");
            }
Exemplo n.º 7
0
            private void UserAgentShouldDefaultToAllowAny()
            {
                var userAgentRecord = new UserAgentRecord();

                userAgentRecord.UserAgent.Should().Be("*");
            }