Beispiel #1
0
        /// <summary>
        /// Initializes all the settings values from the config.
        /// </summary>
        private void Initialize()
        {
            try
            {
                this.ProductVersion = VersionParser.FromSemanticString(WebConfigurationManager.AppSettings[ZoombracoConstants.Configuration.Version]);
            }
            catch
            {
                LogHelper.Info <ZoombracoConfiguration>($"No {ZoombracoConstants.Configuration.Version} appsetting found.");
                this.ProductVersion = new SemVersion(0);
            }

            int duration;

            if (int.TryParse(WebConfigurationManager.AppSettings[ZoombracoConstants.Configuration.OutputCacheDuration], out duration))
            {
                if (duration > 0)
                {
                    this.OutputCacheDuration = duration;
                }
            }

            int timeout;

            if (int.TryParse(WebConfigurationManager.AppSettings[ZoombracoConstants.Configuration.ImageCdnRequestTimeout], out timeout))
            {
                if (timeout > 0)
                {
                    this.ImageCdnRequestTimeout = timeout;
                }
            }
        }
 public void VersionParserThrowsWhenGivenNull()
 {
     Assert.Throws(typeof(ArgumentNullException), () =>
     {
         SemVersion error = VersionParser.FromSemanticString(null);
     });
 }
        public void VersionParserResolvesOrderCorrectly()
        {
            SemVersion beta1   = VersionParser.FromSemanticString("0.5.0-beta.1");
            SemVersion beta2   = VersionParser.FromSemanticString("0.5.0-beta.2");
            SemVersion release = VersionParser.ZoombracoProductVersion();

            Assert.True(release > beta1);
            Assert.True(release > beta2);
            Assert.True(beta2 > beta1);
        }