public void RepeatedSelectorAppearingInDifferentNestedMediaQueriesIsFine()
        {
            var content = new[]
            {
                CSSFragmentBuilderSelector.New(
                    "div.Header",
                    CSSFragmentBuilderStyleProperty.New("color", "red")
                    ).ToContainerFragment(),
                CSSFragmentBuilderSelector.New(
                    "@media screen and (max-width:70em)",
                    CSSFragmentBuilderSelector.New(
                        "div.Header",
                        CSSFragmentBuilderStyleProperty.New("color", "blue"),
                        CSSFragmentBuilderSelector.New(
                            "@media screen and (max-width:30em)",
                            CSSFragmentBuilderSelector.New(
                                "div.Header",
                                CSSFragmentBuilderStyleProperty.New("color", "yellow")
                                )
                            )
                        )
                    ).ToContainerFragment()
            };

            var ruleEnforcer = new NoSelectorMayBeRepeatedInTheRules(
                NoSelectorMayBeRepeatedInTheRules.ConformityOptions.AllowBareSelectorsToBeRepeated
                );

            ruleEnforcer.EnsureRulesAreMet(content);
        }
        public void EmptyContentIsFine()
        {
            var ruleEnforcer = new NoSelectorMayBeRepeatedInTheRules(
                NoSelectorMayBeRepeatedInTheRules.ConformityOptions.AllowBareSelectorsToBeRepeated
                );

            ruleEnforcer.EnsureRulesAreMet(new ICSSFragment[0]);
        }
        public void NullInputWillThrowAnException()
        {
            var ruleEnforcer = new NoSelectorMayBeRepeatedInTheRules(
                NoSelectorMayBeRepeatedInTheRules.ConformityOptions.AllowBareSelectorsToBeRepeated
                );

            Assert.Throws <ArgumentNullException>(() =>
            {
                ruleEnforcer.EnsureRulesAreMet(null);
            });
        }
        public void SinglePropertyIsFine()
        {
            var content = new[]
            {
                CSSFragmentBuilderSelector.New(
                    "div.Header",
                    CSSFragmentBuilderStyleProperty.New("color", "red")
                    ).ToContainerFragment()
            };

            var ruleEnforcer = new NoSelectorMayBeRepeatedInTheRules(
                NoSelectorMayBeRepeatedInTheRules.ConformityOptions.AllowBareSelectorsToBeRepeated
                );

            ruleEnforcer.EnsureRulesAreMet(content);
        }
        public void RepeatedSelectorsWithDifferentStylesIsNotAcceptable()
        {
            var content = new[]
            {
                CSSFragmentBuilderSelector.New(
                    "div.Header",
                    CSSFragmentBuilderStyleProperty.New("color", "red")
                    ).ToContainerFragment(),
                CSSFragmentBuilderSelector.New(
                    "div.Header",
                    CSSFragmentBuilderStyleProperty.New("color", "blue")
                    ).ToContainerFragment()
            };

            var ruleEnforcer = new NoSelectorMayBeRepeatedInTheRules(
                NoSelectorMayBeRepeatedInTheRules.ConformityOptions.AllowBareSelectorsToBeRepeated
                );

            Assert.Throws <NoSelectorMayBeRepeatedInTheRules.NoSelectorMayBeRepeatedInTheRulesException>(() =>
            {
                ruleEnforcer.EnsureRulesAreMet(content);
            });
        }