public void ObtainDefaultSheet()
 {
     var engine = new CssStyleEngine();
     Assert.IsNotNull(engine.Default);
     Assert.AreEqual("text/css", engine.Type);
     var sheet = engine.Default as CssStyleSheet;
     Assert.IsNotNull(sheet);
     Assert.AreEqual(49, sheet.Rules.Length);
 }
        /// <summary>
        /// Registers the default styling service with a new CSS style engine
        /// to retrieve, if no other styling service has been registered yet.
        /// </summary>
        /// <param name="configuration">The configuration to extend.</param>
        /// <param name="setup">Optional setup for the style engine.</param>
        /// <returns>The new instance with the service.</returns>
        public static IConfiguration WithCss(this IConfiguration configuration, Action<CssStyleEngine> setup = null)
        {
            if (configuration == null)
                throw new ArgumentNullException("configuration");
            
            if (configuration.GetServices<IStylingService>().Any() == false)
            {
                var service = new StylingService();
                var engine = new CssStyleEngine();

                if (setup != null)
                    setup(engine);

                service.Register(engine);
                return configuration.With(service);
            }

            return configuration;
        }