Unit test BO without actually connect to DB


Author
Message
Chan
Chan
Advanced StrataFrame User (965 reputation)Advanced StrataFrame User (965 reputation)Advanced StrataFrame User (965 reputation)Advanced StrataFrame User (965 reputation)Advanced StrataFrame User (965 reputation)Advanced StrataFrame User (965 reputation)Advanced StrataFrame User (965 reputation)Advanced StrataFrame User (965 reputation)Advanced StrataFrame User (965 reputation)
Group: Forum Members
Posts: 533, Visits: 2K
Hi,

I would like to test my BO biz rule. However, I don't want to connect to actual database, so that the testing can completed faster. Additionally, I would like to have "dependecy injection" for data layer so that I could prepare my test data there.



What is the recommended approach to do this in SF environment?



Thank you
Reply
StrataFrame Team
S
StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
You would need to overload the GetCustomerType() method to allow you to pass a parameter that would tell whether it can use database access.  So, if you call GetCustomerType(false) and you have all the information you need in memory, then it won't need to connect to the database again, just return the cached value.  Otherwise, if you don't have the data already retrieved then you're still going to probably need to retrieve the value from the database.
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Threaded View
Threaded View
Chan - 18 Years Ago
Peter Jones - 18 Years Ago
Trent L. Taylor - 18 Years Ago
Chan - 18 Years Ago
Trent L. Taylor - 18 Years Ago
                         Hi,
I have OrdersBO, OrderDetailsBO. I am writing unit test for...
Chan - 18 Years Ago
                             You might consider adding to the fill method that is used, then...
Greg McGuffey - 18 Years Ago
                                 You would need to overload the GetCustomerType() method to allow you...
StrataFrame Team - 18 Years Ago

Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search