As I use SharpDevelop as my primary IDE, I found unit testing debugging fairly hard as there is not such an advanced debugger as VS has. Anyway, the solution will be to be possible to run not only by me, but by anyone that do not have an integrated NUnit (like VS Express users) or not an very advanced debugger (as myself), to run them without it. The main change was to change the unit test's class library to a console application.
I also reviewed the capabilities code as it may be used to other components like a future right click to components.
This code needs some changes as it has to create too many children and the code there may get fuzzy and hard to debug. Also the capabilities old code had no clear separation between concepts and capabilities and capabilities did not had keys/values as most persons will expect from a dictionary like code.
The redesigned code it does the following: you can create a concept (like an abstract item likewise is: shape, feature, etc.) To any concept you can add capabilities (that is a key/value pair) and a relation of Is-A to another concept. In this way you can inherit all properties of another concept. Also a concept when is related with another and both the class and the related concept have a value, the capabilities are searched firstly in the current concept, later inside it's relations.
Here is how Rectangle based shape will get as default icon the Shape's icon:
var shapeConcept = Capabilities.AddConcept(ConceptNames.Shape);
shapeConcept.SetCapability(CapabilitiesNames.DefaultIcon, "../Resources/box.png");
(...)
Capabilities.AddRelation(FunctionNames.Rectangle, ConceptNames.Shape);
TreeView's code was updated for those changes but not all shapes are defined as right now with proper relations. Also, the capabilities code need to have more tests in the unit tests and to use it to find some misses. If everything will work fine, the concept can be extended for more inherited like code that just need to setup a key and a value for them and there is no need to create large class hierarchies for this.
Download the nightly build from here.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment