Some design issues of a Test project

2 views
Skip to first unread message

Foyzul Karim

unread,
Oct 1, 2011, 11:46:30 AM10/1/11
to agi...@googlegroups.com
Hello everyone.
For last 1+ year, i have been doing a pet project to practice TDD and try to implement some design principles.

In essence, I 100% followed two main principles of TDD and coding. Those are:
1. Never repeat your code.
2. Never write development code without test code.

After 1+ year, this project has evolved in 20+ Entities and respective Gateways, Managers and Unit test classes as well. You will get the test project's class diagram attached with this mail.

In summary, in my test project, i made an interface:

    interface IManagerTest<T> where T:class 
    {
        void Insert_Should_Return_IsSuccess_False_When_Object_Is_Null();
        void Insert_Should_Return_IsSuccess_True_When_Object_Is_Saved();
        void Delete_Should_Return_IsSuccess_False_When_Object_Id_Not_Found();
        void Delete_Should_Return_IsSuccess_True_When_Object_Is_Deleted();
        void Update_Should_Return_IsSuccess_False_When_Object_Id_Not_Found();
        void Update_Should_Return_IsSuccess_True_When_Object_Is_Updated();
        void GetObjectById_Should_Return_Null_If_Id_Is_Null_Or_Empty();
        void GetObjectById_Should_Return_Null_If_Object_Is_Not_Found();
        void GetObjectById_Should_Return_Object_If_Id_Is_Found();
        void GetAll_Should_Return_List_Of_Objects();        
        DSResult Insert(T  o);
        DSResult Delete(T  o);
        void AssertProperties(T expected, T actual);
    }

I added extra method in test class if needed.

And each of my Manager Tester classes implements that interface. For example:

    [TestClass]
    public class AdviceManagerTest : TestBaseManager, IManagerTest<t_Advice>
    {
       .........
       .........
    }

And for example, the implementation of AssertProperties method is like below:
        public void AssertProperties(t_Advice expected, t_Advice actual)
        {
         ........
         .......
        }

My question is:
  • Did i break any rule of TDD  by using interface in unit testing? 
  • What alternatives do I have if i don't want to use the mentioned interface for testing the managers?
  • I will be really helped if someone please made some critics on the code and the design also. 


I am ready to share some of the .CS files if anyone interested to see.

Sincerely
Foyzul Karim
The Databiz Software Limited
Dhaka
Bangladesh
ClassDiagram1.png

SM Sohan

unread,
Oct 1, 2011, 11:53:13 AM10/1/11
to agi...@googlegroups.com
Can you host your code at github? I'm sure people will find it easy to comment that way. At least, I myself will.

___
Sent from my iPhone
S M Sohan

--
You received this message because you are subscribed to the Google Groups "Agile Bangladesh" group.
To post to this group, send email to agi...@googlegroups.com.
To unsubscribe from this group, send email to agilebd+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/agilebd?hl=en.
<ClassDiagram1.png>

Foyzul Karim

unread,
Oct 1, 2011, 11:55:18 AM10/1/11
to agi...@googlegroups.com
Thanks Sohan Bhai.
I will try ASAP

Regards
Foyzul Karim
Programmer

The Databiz Software Limited
Dhaka
Bangladesh


Reply all
Reply to author
Forward
0 new messages