예제 #1
0
 public void HaveDefaultClientScripts()
 {
     var section = new Section();
     Assert.NotNull(section.ClientScripts);
     Assert.True(section.ClientScripts.AutoDiscover);
     Assert.Empty(section.ClientScripts.DiscoveryLocation);
     Assert.Empty(section.ClientScripts.IgnoredTypes);
 }
예제 #2
0
        public void SetClientScriptsElement()
        {
            var scripts = new DiscoverableCollectionElement(){AutoDiscover = false};

            var section = new Section();

            section.ClientScripts = scripts;

            Assert.Equal(scripts, section.ClientScripts);
        }
예제 #3
0
        public void SetLoggingElement()
        {
            var loggingElement = new LoggingElement();

            var section = new Section();

            section.Logging = loggingElement;

            Assert.Equal(loggingElement, section.Logging);
        }
예제 #4
0
 /// <summary>
 /// Provides implementations an instance of <see cref="Section" /> to self populate any end user configuration options.
 /// </summary>
 /// <param name="section">The configuration section, <c>&lt;glimpse&gt;</c> from <c>web.config</c>.</param>
 /// <remarks>
 /// Populates the status code white list with values from <c>web.config</c>.
 /// </remarks>
 /// <example>
 /// Configure the status code white list in <c>web.config</c> with the following entries:
 /// <code>
 /// <![CDATA[
 /// <glimpse defaultRuntimePolicy="On" endpointBaseUri="~/Glimpse.axd">
 ///     <runtimePolicies>
 ///         <statusCodes>
 ///             <!-- <clear /> clear to reset defaults -->
 ///             <add statusCode="{code}" />
 ///         </statusCodes>
 ///     </runtimePolicies>
 /// </glimpse>
 /// ]]>
 /// </code>
 /// </example>
 public void Configure(Section section)
 {
     foreach (StatusCodeElement item in section.RuntimePolicies.StatusCodes)
     {
         StatusCodeWhiteList.Add(item.StatusCode);
     }
 }
예제 #5
0
 /// <summary>
 /// Provides implementations an instance of <see cref="Section" /> to self populate any end user configuration options.
 /// </summary>
 /// <param name="section">The configuration section, <c>&lt;glimpse&gt;</c> from <c>web.config</c>.</param>
 /// <remarks>
 /// Populates the Uri black list with values from <c>web.config</c>.
 /// </remarks>
 /// <example>
 /// Configure the Uri black list in <c>web.config</c> with the following entries:
 /// <code>
 /// <![CDATA[
 /// <glimpse defaultRuntimePolicy="On" endpointBaseUri="~/Glimpse.axd">
 ///     <runtimePolicies>
 ///         <uris>
 ///             <!-- <clear /> clear to reset defaults -->
 ///             <add regex="{regular expression or uri}" />
 ///         </uris>
 ///     </runtimePolicies>
 /// </glimpse>
 /// ]]>
 /// </code>
 /// </example>
 public void Configure(Section section)
 {
     UriBlackList.Add(new Regex("__browserLink/requestData")); 
     foreach (RegexElement item in section.RuntimePolicies.Uris)
     {
         UriBlackList.Add(item.Regex);
     }
 }
예제 #6
0
        public void GetSetBasePolicy()
        {
            var basePolicy = RuntimePolicy.ModifyResponseBody;

            var section = new Section();

            section.DefaultRuntimePolicy = basePolicy;

            Assert.Equal(basePolicy, section.DefaultRuntimePolicy);
        }
예제 #7
0
        public void ReturnDefaultBasePolicy()
        {
            var section = new Section();

            Assert.Equal(RuntimePolicy.Off, section.DefaultRuntimePolicy);
        }
예제 #8
0
        public void ReturnDefaultRuntimePolicies()
        {
            var section = new Section();

            var element = section.RuntimePolicies;

            Assert.NotNull(element);
            Assert.True(element.AutoDiscover);
            Assert.Empty(element.IgnoredTypes);
            Assert.Empty(element.DiscoveryLocation);
        }
예제 #9
0
 public void HaveDefaultLoggingLevel()
 {
     var section = new Section();
     Assert.Equal(LoggingLevel.Off, section.Logging.Level);
 }
예제 #10
0
        public void GetSetDefaultServiceLocatorType()
        {
            var section = new Section();
            var type = typeof (SectionShould);

            section.ServiceLocatorType = type;

            Assert.Equal(type, section.ServiceLocatorType);
            
        }
예제 #11
0
        public void ReturnDefaultServiceLocatorType()
        {
            var section = new Section();

            Assert.Null(section.ServiceLocatorType);
        }
예제 #12
0
        public void GetSetSerializationConverters()
        {
            var section = new Section();

            var element = new DiscoverableCollectionElement { AutoDiscover = false };

            section.SerializationConverters = element;

            Assert.Equal(element, section.SerializationConverters);
        }
예제 #13
0
        public void ReturnDefaultSerializationConverters()
        {
            var section = new Section();

            var element = section.SerializationConverters;

            Assert.NotNull(element);
            Assert.True(element.AutoDiscover);
            Assert.Empty(element.IgnoredTypes);
            Assert.Empty(element.DiscoveryLocation);
        }
예제 #14
0
        public void GetSetRuntimePolicies()
        {
            var section = new Section();

            var element = new PolicyDiscoverableCollectionElement {AutoDiscover = false};

            section.RuntimePolicies = element;

            Assert.Equal(element, section.RuntimePolicies);
        }
예제 #15
0
 /// <summary>
 /// Provides implementations an instance of <see cref="Section" /> to self populate any end user configuration options.
 /// </summary>
 /// <param name="section">The configuration section, <c>&lt;glimpse&gt;</c> from <c>web.config</c>.</param>
 /// <remarks>
 /// Populates the content type white list with values from <c>web.config</c>.
 /// A list of ratified Http status codes is available in <see href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html">Section 10 of RFC 2616</see>, the Http version 1.1 specification.
 /// </remarks>
 /// <example>
 /// Configure the content type white list in <c>web.config</c> with the following entries:
 /// <code>
 /// <![CDATA[
 /// <glimpse defaultRuntimePolicy="On" endpointBaseUri="~/Glimpse.axd">
 ///     <runtimePolicies>
 ///         <contentTypes>
 ///             <!-- <clear /> clear to reset defaults -->
 ///             <add contentType="{media\type}" runtimePolicy="on" />
 ///         </contentTypes>
 ///     </runtimePolicies>
 /// </glimpse>
 /// ]]>
 /// </code>
 /// </example>
 public void Configure(Section section)
 {
     foreach (ContentTypeElement item in section.RuntimePolicies.ContentTypes)
     {
         ContentTypeWhiteList.Add(new Tuple<string, RuntimePolicy>(item.ContentType, item.RuntimePolicy));
     }
 }
예제 #16
0
        public void LeverageConfigurationWhenCreatingDiscoverableCollection()
        {
            var path = @"c:\Windows";
            var config = new Section {ClientScripts = {DiscoveryLocation = path, AutoDiscover = false}};

            var locatorMock = new Mock<IServiceLocator>();
            locatorMock.Setup(l => l.GetAllInstances<IClientScript>()).Returns<ICollection<IClientScript>>(null);

            var factory = new Factory(locatorMock.Object){Configuration = config};

            var result = factory.InstantiateClientScripts();

            var discoverableCollection = result as IDiscoverableCollection<IClientScript>;

            Assert.Equal(path, discoverableCollection.DiscoveryLocation);
        }
예제 #17
0
        public void GetSetTabs()
        {
            var section = new Section();

            var element = new DiscoverableCollectionElement(){AutoDiscover = false};

            section.Tabs = element;

            Assert.Equal(element, section.Tabs);
        }