Example #1
0
        public void CombinedArchRuleCombinedAndOrTest()
        {
            var thisClassExistsAndThisClassExistsOrThisClassExists =
                ThisClassExists.And(Classes().That().Are(ThisClass).Should().Exist()).Or().Classes().That()
                .Are(ThisClass).Should().Exist();
            var thisClassExistsOrThisClassDoesNotExistOrThisClassExistsAndThisClassDoesNotExist =
                ThisClassExists.Or(ThisClassDoesNotExist).Or(ThisClassExists).And(ThisClassDoesNotExist);
            var thisClassExistsOrThisClassDoesNotExistAndThisClassExists =
                ThisClassExists.Or(ThisClassDoesNotExist).And(ThisClassExists);
            var thisClassDoesNotExistAndThisClassExistsOrThisClassDoesNotExist =
                ThisClassDoesNotExist.And(ThisClassExists).Or(ThisClassDoesNotExist);

            var thisClassExistsOrThisClassDoesNotExistOrJoinedThisClassExistsAndThisClassDoesNotExist =
                ThisClassExists.Or(ThisClassDoesNotExist).Or(ThisClassExists.And(ThisClassDoesNotExist));
            var thisClassExistsOrJoinedThisClassDoesNotExistAndThisClassExists =
                ThisClassExists.Or(ThisClassDoesNotExist.And(ThisClassExists));

            Assert.True(thisClassExistsAndThisClassExistsOrThisClassExists.HasNoViolations(Architecture));
            Assert.False(
                thisClassExistsOrThisClassDoesNotExistOrThisClassExistsAndThisClassDoesNotExist.HasNoViolations(
                    Architecture));
            Assert.True(thisClassExistsOrThisClassDoesNotExistAndThisClassExists.HasNoViolations(Architecture));
            Assert.False(thisClassDoesNotExistAndThisClassExistsOrThisClassDoesNotExist.HasNoViolations(Architecture));

            Assert.True(
                thisClassExistsOrThisClassDoesNotExistOrJoinedThisClassExistsAndThisClassDoesNotExist.HasNoViolations(
                    Architecture));
            Assert.True(thisClassExistsOrJoinedThisClassDoesNotExistAndThisClassExists.HasNoViolations(Architecture));
        }
Example #2
0
        public void CombinedArchRuleOrTest()
        {
            var thisClassExistsOrThisClassExists1 =
                ThisClassExists.Or().Classes().That().Are(ThisClass).Should().Exist();
            var thisClassExistsOrThisClassDoesNotExist1 =
                ThisClassExists.Or().Classes().That().Are(ThisClass).Should().NotExist();
            var thisClassDoesNotExistOrThisClassExists1 =
                ThisClassDoesNotExist.Or().Classes().That().Are(ThisClass).Should().Exist();
            var thisClassDoesNotExistOrThisClassDoesNotExist1 =
                ThisClassDoesNotExist.Or().Classes().That().Are(ThisClass).Should().NotExist();


            var thisClassExistsOrThisClassExists2             = ThisClassExists.Or(ThisClassExists);
            var thisClassExistsOrThisClassDoesNotExist2       = ThisClassExists.Or(ThisClassDoesNotExist);
            var thisClassDoesNotExistOrThisClassExists2       = ThisClassDoesNotExist.Or(ThisClassExists);
            var thisClassDoesNotExistOrThisClassDoesNotExist2 = ThisClassDoesNotExist.Or(ThisClassDoesNotExist);

            var thisClassExistsOrThisClassExistsOrThisClassExists =
                ThisClassExists.Or(thisClassExistsOrThisClassExists2);
            var thisClassExistsOrThisClassExistsOrThisClassExistsOrThisClassExists =
                thisClassExistsOrThisClassExists2.Or(thisClassExistsOrThisClassExists2);
            var thisClassExistsOrThisClassExistsOrThisClassDoesNotExist =
                ThisClassExists.Or(thisClassExistsOrThisClassDoesNotExist2);
            var thisClassExistsOrThisClassDoesNotExistOrThisClassExists =
                thisClassExistsOrThisClassDoesNotExist2.Or(ThisClassExists);
            var thisClassDoesNotExistOrThisClassDoesNotExistOrThisClassDoesNotExist =
                ThisClassDoesNotExist.Or(thisClassDoesNotExistOrThisClassDoesNotExist2);

            Assert.True(thisClassExistsOrThisClassExists1.HasNoViolations(Architecture));
            Assert.True(thisClassExistsOrThisClassDoesNotExist1.HasNoViolations(Architecture));
            Assert.True(thisClassDoesNotExistOrThisClassExists1.HasNoViolations(Architecture));
            Assert.False(thisClassDoesNotExistOrThisClassDoesNotExist1.HasNoViolations(Architecture));

            Assert.True(thisClassExistsOrThisClassExists2.HasNoViolations(Architecture));
            Assert.True(thisClassExistsOrThisClassDoesNotExist2.HasNoViolations(Architecture));
            Assert.True(thisClassDoesNotExistOrThisClassExists2.HasNoViolations(Architecture));
            Assert.False(thisClassDoesNotExistOrThisClassDoesNotExist2.HasNoViolations(Architecture));

            Assert.True(thisClassExistsOrThisClassExistsOrThisClassExists.HasNoViolations(Architecture));
            Assert.True(
                thisClassExistsOrThisClassExistsOrThisClassExistsOrThisClassExists.HasNoViolations(Architecture));
            Assert.True(thisClassExistsOrThisClassExistsOrThisClassDoesNotExist.HasNoViolations(Architecture));
            Assert.True(thisClassExistsOrThisClassDoesNotExistOrThisClassExists.HasNoViolations(Architecture));
            Assert.False(
                thisClassDoesNotExistOrThisClassDoesNotExistOrThisClassDoesNotExist.HasNoViolations(Architecture));
        }