Example #1
0
        public void MethodName_HasAPartThat_NotExistInDictionary_IsNotPronounceable()
        {
            var pronounceableRule = QualityRules.PronounceableName;
            var name = "ValidateKMLS";

            var method             = MockMethod.EmptyMethod(name);
            var methodNameAnalyzer = new MethodName(TestBootStrapped.GetInstanceOfNamingConvention());

            methodNameAnalyzer.Analyze(method);
            var analyzeResult = methodNameAnalyzer.GetResult();

            var isPronounceable = !analyzeResult.Any(a => a.ViolatedRule.Equals(pronounceableRule));

            Assert.IsFalse(isPronounceable);
        }
Example #2
0
        public void MethodName_StartsByNoun_HasAnalyzerError()
        {
            var partOfPeachRule = QualityRules.VerbForMethodName;
            var nounName        = "validation";

            var method             = MockMethod.EmptyMethod(nounName);
            var methodNameAnalyzer = new MethodName(TestBootStrapped.GetInstanceOfNamingConvention());

            methodNameAnalyzer.Analyze(method);
            var analyzeResult = methodNameAnalyzer.GetResult();

            var hasRightPartOfPeach = !analyzeResult.Any(a => a.ViolatedRule.Equals(partOfPeachRule));

            Assert.IsFalse(hasRightPartOfPeach);
        }
Example #3
0
        public void MethodName_HasLenght_BiggerThanLimitSize_ISSearchable()
        {
            var pronounceableRule = QualityRules.PronounceableName;
            var name = "ValidatePKDMN";

            var method             = MockMethod.EmptyMethod(name);
            var methodNameAnalyzer = new MethodName(TestBootStrapped.GetInstanceOfNamingConvention());

            methodNameAnalyzer.Analyze(method);
            var analyzeResult = methodNameAnalyzer.GetResult();

            var isPronounceable = !analyzeResult.Any(a => a.ViolatedRule.Equals(pronounceableRule));

            Assert.IsFalse(isPronounceable);
        }
Example #4
0
        public void MethodName_StartsByGerunds_HasNotPosError()
        {
            var partOfSpeachRule = QualityRules.VerbForMethodName;
            var verbName         = "validate";

            var method             = MockMethod.EmptyMethod(verbName);
            var methodNameAnalyzer = new MethodName(TestBootStrapped.GetInstanceOfNamingConvention());

            methodNameAnalyzer.Analyze(method);
            var analyzeResult = methodNameAnalyzer.GetResult();

            var hasRightPartOfSpeech = !analyzeResult.Any(a => a.ViolatedRule.Equals(partOfSpeachRule));

            Assert.IsTrue(hasRightPartOfSpeech);
        }
Example #5
0
        public void MethodName_WithPartsThat_ExistInDictionary_IsPronounceable()
        {
            var pronounceableRule = QualityRules.PronounceableName;
            var name = "ValidateSomeFieldsWithSmallName";

            var method             = MockMethod.EmptyMethod(name);
            var methodNameAnalyzer = new MethodName(TestBootStrapped.GetInstanceOfNamingConvention());

            methodNameAnalyzer.Analyze(method);
            var analyzeResult = methodNameAnalyzer.GetResult();

            var isPronounceable = !analyzeResult.Any(a => a.ViolatedRule.Equals(pronounceableRule));

            Assert.IsTrue(isPronounceable);
        }
Example #6
0
        public void ClassName_WithPartsThat_ExistInDictionary_IsPronounceable()
        {
            var pronounceableRule = QualityRules.PronounceableName;
            var name = "CustomerValidation";

            var classDef          = MockClass.EmptyClass(name);
            var classNameAnalyzer = new ClassName(TestBootStrapped.GetInstanceOfNamingConvention());

            classNameAnalyzer.Analyze(classDef);
            var analyzeResult = classNameAnalyzer.GetResult();

            var isPronounceable = !analyzeResult.Any(a => a.ViolatedRule.Equals(pronounceableRule));

            Assert.IsTrue(isPronounceable);
        }
Example #7
0
        public void ClassName_HasLength_BiggerThanLimitSize_IsSearchable()
        {
            var pronounceableRule = QualityRules.PronounceableName;
            var name = "ValidatePKDMN";

            var classDef          = MockClass.EmptyClass(name);
            var classNameAnalyzer = new ClassName(TestBootStrapped.GetInstanceOfNamingConvention());

            classNameAnalyzer.Analyze(classDef);
            var analyzeResult = classNameAnalyzer.GetResult();

            var isPronounceable = !analyzeResult.Any(a => a.ViolatedRule.Equals(pronounceableRule));

            Assert.IsFalse(isPronounceable);
        }
Example #8
0
        public void ClassName_StartsByNoun_HasHasNotPosError()
        {
            var partOfPeachRule = QualityRules.NounForClassName;
            var nounName        = "validation";

            var classDef          = MockClass.EmptyClass(nounName);
            var classNameAnalyzer = new ClassName(TestBootStrapped.GetInstanceOfNamingConvention());

            classNameAnalyzer.Analyze(classDef);
            var analyzeResult = classNameAnalyzer.GetResult();

            var hasRightPartOfPeach = !analyzeResult.Any(a => a.ViolatedRule.Equals(partOfPeachRule));

            Assert.IsTrue(hasRightPartOfPeach);
        }
Example #9
0
        public void MethodName_HasLenght_SmallerThanLimitSize_ISNotSearchable()
        {
            var searchableRule = QualityRules.SearchableName;
            var minimLength    = new Metric().MinimumLengthOfName;
            var name           = NameHelper.RandomString(minimLength - 1);

            var method             = MockMethod.EmptyMethod(name);
            var methodNameAnalyzer = new MethodName(TestBootStrapped.GetInstanceOfNamingConvention());

            methodNameAnalyzer.Analyze(method);
            var analyzeResult = methodNameAnalyzer.GetResult();

            var isSearchable = !analyzeResult.Any(a => a.ViolatedRule.Equals(searchableRule));

            Assert.IsFalse(isSearchable);
        }
Example #10
0
        public void ClassName_HasLength_SmallerThanLimitSize_IsNotSearchable()
        {
            var searchableRule = QualityRules.SearchableName;
            var minimLength    = new Metric().MinimumLengthOfName;
            var name           = NameHelper.RandomString(minimLength - 1);

            var classDef          = MockClass.EmptyClass(name);
            var classNameAnalyzer = new ClassName(TestBootStrapped.GetInstanceOfNamingConvention());

            classNameAnalyzer.Analyze(classDef);
            var analyzeResult = classNameAnalyzer.GetResult();

            var isSearchable = !analyzeResult.Any(a => a.ViolatedRule.Equals(searchableRule));

            Assert.IsFalse(isSearchable);
        }