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); }
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); }
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); }
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); }
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); }
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); }
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); }
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); }
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); }
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); }