Exemple #1
0
        public void ClassesWithMoreThanThreeCollaboratorsBreakRule(string typeName, int expectedProblemCount)
        {
            var rule = new MaxCollaboratorsRule();

            rule.Check(AssemblyReader.GetType(typeName));
            Assert.That(rule.Problems.Count, Is.EqualTo(expectedProblemCount));
        }
        public void CallsToBaseClassMethodsDontCount(string typeName, int expectedProblemCount)
        {
            var rule = new ClientInterfaceRule();

            rule.Check(AssemblyReader.GetType(typeName));
            Assert.AreEqual(expectedProblemCount, rule.Problems.Count);
        }
        public void InterfacesWithMoreMethodsThatClientUsesBreakRule(string typeName, int expectedProblemCount)
        {
            var rule = new ClientInterfaceRule();

            rule.Check(AssemblyReader.GetType(typeName));
            Assert.AreEqual(expectedProblemCount, rule.Problems.Count);
        }
Exemple #4
0
        public void TypesWithMoreThanTenMethodsOrPropertiesBreakRule(string typeName, int expectedProblemCount)
        {
            var rule = new LargeClassRule();

            rule.Check(AssemblyReader.GetType(typeName));
            Assert.AreEqual(expectedProblemCount, rule.Problems.Count);
        }
        private void CheckIfCollaboratorFound(string typeName, string collaboratorTypeName)
        {
            var collaboratorCount = new CollaboratorCount();
            var type = AssemblyReader.GetType(typeName);

            Assert.That(collaboratorCount.GetCollaboratorsFor(type)
                        .ToList()
                        .Exists(c => c.Name.Name == collaboratorTypeName));
        }
        public void DoesntIncludeBaseClasses()
        {
            var collaboratorCount = new CollaboratorCount();
            var type = AssemblyReader.GetType("ThisClass");

            Assert.That(!collaboratorCount.GetCollaboratorsFor(type)
                        .ToList()
                        .Exists(c => c.Name.Name == "BaseClass"));
        }