At the moment, our coupling metric calculate the CBO (Coupling between object) metric. We should write golden tests to secure the working functionality before refactoring the code and detect other test case to fulfill the CBO metric.
The implemented test cases should fulfill these goals :
Golden tests (which should run successful for the current implementation):
[x] Referencing of enum is dependency.
[x] Referencing of interface is dependency.
[x] Referencing of struct is dependency.
[x] Referencing of delegate is dependency.
[x] Creating object from generic class or method should be a dependency to the type arguments. This generic object definition should be a coupling to ClassA and ClassB:
var genericObject = new GenericClass<ClassA, ClassB>; //dependency to ClassA and ClassB
var objectForGenericMethod object = new ForGenericMethod();
object.GenericMethod<TypeArgument>(); //dependency to TypeArgument
[x] Testing if extending another class can be detected.
[x] Type conversion (as expression and type casting) should be counted for coupling metric.
[x] If there are two classes in one file and One Class uses the other class. There should be a relation between the file and it self.
[x] If there are two interfaces, delegates or other types in one file and One type uses the other type (not class). There should be a relation between the file and it self.
Other test cases for CBO, which may fail because the current implementation is not complete:
[x] call-expression on non-static method should be counted as dependency. Ex: classA.methodOfA() in this code:
using namespaceOfClassA;
...
ClassA classA = new ClassA();
classA.methodOfA();
[ ] Find a test case, where the method getAdditionalRelationships() in call-expression-resolver.ts is relevant.
[x] Extension method should be involved in the coupling metric.
[x] Coupling calculation should work without namespace definitions.
[x] Chaining method calls should result dependency to the return type.
[x] Test if dependecies from multiple classes in a file can be detected.
DOD:
[ ] For all listed points there are example files.
[ ] For all listed points there are tests.
[ ] For all listed points the snapshot is adjusted to show the expected behaviour.
At the moment, our coupling metric calculate the CBO (Coupling between object) metric. We should write golden tests to secure the working functionality before refactoring the code and detect other test case to fulfill the CBO metric. The implemented test cases should fulfill these goals : Golden tests (which should run successful for the current implementation):
as
expression and type casting) should be counted for coupling metric.Other test cases for CBO, which may fail because the current implementation is not complete:
classA.methodOfA()
in this code:getAdditionalRelationships()
incall-expression-resolver.ts
is relevant.DOD: