Design for testable


Author
Message
ChanKK
ChanKK
StrataFrame User (248 reputation)StrataFrame User (248 reputation)StrataFrame User (248 reputation)StrataFrame User (248 reputation)StrataFrame User (248 reputation)StrataFrame User (248 reputation)StrataFrame User (248 reputation)StrataFrame User (248 reputation)StrataFrame User (248 reputation)
Group: Forum Members
Posts: 190, Visits: 1.3K
Hi,

I am using application framework to develop application. The framework come with BusinessObject base class. Developer will always inherit from it to create any other business object.



I have question that, for some method, I am not designed to allow overriable. It has restricted me from unit test, whereby, sometime I need to have "mock" business object so that I don't have to have connection to database. I can just "simulate" the result at the BO.Method(). Since my method is not designed for overriable, it has limited me to do what I need. Most importantly, I need to utilize some of the BO base class function as well.



Now, I am using conditional compilation to achieve this. I would like to know if any better way. I found I can might able to use delegate, but I am not so sure about it. Any advice?



Thank you
Trent Taylor
Trent Taylor
StrataFrame Developer (8.5K reputation)StrataFrame Developer (8.5K reputation)StrataFrame Developer (8.5K reputation)StrataFrame Developer (8.5K reputation)StrataFrame Developer (8.5K reputation)StrataFrame Developer (8.5K reputation)StrataFrame Developer (8.5K reputation)StrataFrame Developer (8.5K reputation)StrataFrame Developer (8.5K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
What properties and methods would you like to be able to overwrite?
ChanKK
ChanKK
StrataFrame User (248 reputation)StrataFrame User (248 reputation)StrataFrame User (248 reputation)StrataFrame User (248 reputation)StrataFrame User (248 reputation)StrataFrame User (248 reputation)StrataFrame User (248 reputation)StrataFrame User (248 reputation)StrataFrame User (248 reputation)
Group: Forum Members
Posts: 190, Visits: 1.3K
Hi,

Most of the time, I would like to override those method that fill data such as BO.FillByXXXX() because I don't want to to reply on database while testing on logic. Instead, I prefer to override BO.FillByXXXX() and "simulate" the return data based for each scenario.



Of course, BO.FillByXXXX() by right is not designed to be override in application.



Please advice, Thank you
Trent Taylor
Trent Taylor
StrataFrame Developer (8.5K reputation)StrataFrame Developer (8.5K reputation)StrataFrame Developer (8.5K reputation)StrataFrame Developer (8.5K reputation)StrataFrame Developer (8.5K reputation)StrataFrame Developer (8.5K reputation)StrataFrame Developer (8.5K reputation)StrataFrame Developer (8.5K reputation)StrataFrame Developer (8.5K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
I will add all of these to the list.  Most of these should be overridable anyway, so I will start going back and adding these.  Thanks.
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search