Exemplo n.º 1
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);
        }
Exemplo n.º 2
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);
        }
Exemplo n.º 3
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);
        }
Exemplo n.º 4
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);
        }