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); }
public void SetClientScriptsElement() { var scripts = new DiscoverableCollectionElement(){AutoDiscover = false}; var section = new Section(); section.ClientScripts = scripts; Assert.Equal(scripts, section.ClientScripts); }
public void SetLoggingElement() { var loggingElement = new LoggingElement(); var section = new Section(); section.Logging = loggingElement; Assert.Equal(loggingElement, section.Logging); }
/// <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><glimpse></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); } }
/// <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><glimpse></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); } }
public void GetSetBasePolicy() { var basePolicy = RuntimePolicy.ModifyResponseBody; var section = new Section(); section.DefaultRuntimePolicy = basePolicy; Assert.Equal(basePolicy, section.DefaultRuntimePolicy); }
public void ReturnDefaultBasePolicy() { var section = new Section(); Assert.Equal(RuntimePolicy.Off, section.DefaultRuntimePolicy); }
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); }
public void HaveDefaultLoggingLevel() { var section = new Section(); Assert.Equal(LoggingLevel.Off, section.Logging.Level); }
public void GetSetDefaultServiceLocatorType() { var section = new Section(); var type = typeof (SectionShould); section.ServiceLocatorType = type; Assert.Equal(type, section.ServiceLocatorType); }
public void ReturnDefaultServiceLocatorType() { var section = new Section(); Assert.Null(section.ServiceLocatorType); }
public void GetSetSerializationConverters() { var section = new Section(); var element = new DiscoverableCollectionElement { AutoDiscover = false }; section.SerializationConverters = element; Assert.Equal(element, section.SerializationConverters); }
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); }
public void GetSetRuntimePolicies() { var section = new Section(); var element = new PolicyDiscoverableCollectionElement {AutoDiscover = false}; section.RuntimePolicies = element; Assert.Equal(element, section.RuntimePolicies); }
/// <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><glimpse></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)); } }
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); }
public void GetSetTabs() { var section = new Section(); var element = new DiscoverableCollectionElement(){AutoDiscover = false}; section.Tabs = element; Assert.Equal(element, section.Tabs); }