Tagged Questions
2
votes
2answers
126 views
Should I split out synchronization from my class and what's it called?
When thinking about testability and modular code, I recently thought about whether I should split out the synchronization part of a class from the actual behavior part.
By example:
The app "needs" ...
11
votes
3answers
415 views
Is using unit tests to tell a story a good idea?
So, I have an authentication module I wrote some time ago. Now I'm seeing the errors of my way and writing unit tests for it. While writing unit tests, I have a hard time coming up with good names and ...
3
votes
3answers
220 views
iOS - Unit tests for KVO/delegate codes
I am going to design a MVC pattern. It could be either designed as a delegate pattern, or a Key-Value-Observing(KVO), to notify the controller about changing models. The project requires certain ...
9
votes
4answers
413 views
How to unit test a function that is refactored to strategy pattern?
If I have a function in my code that goes like:
class Employee{
public string calculateTax(string name, int salary)
{
switch (name)
{
case "Chris":
...
3
votes
4answers
460 views
When, Where, and How to Unit Test
I'm very familiar with xUnit frameworks and I try to implement unit tests on every project I start. Somewhere along the way, I realize that I'm writing the same tests over and over again, and then I ...
6
votes
7answers
747 views
Can the Strategy pattern be implemented without significant branching?
The Strategy pattern works well to avoid huge if...else constructs and make it easier to add or replace functionality. However, it still leaves one flaw in my opinion. It seems like in every ...
21
votes
6answers
2k views
Is dependency injection essential for unit testing?
Is using dependency injection (DI) essential for unit testing?
I can't think of another alternative for isolating code so it can be tested. Also, all the examples I have ever seen use this pattern. ...
0
votes
1answer
967 views
Implementing a ILogger interface to log data
I have a need to write data to file in one of my classes.
Obviously I will pass an interface into my class to decouple it.
I was thinking this interface will be used for testing and also in other ...
5
votes
4answers
226 views
Type mocking frameworks does not change coding practices from testability point?
Many people recommend that we should code against interfaces and avoid statics for testability.
Interfaces are not just for testability, they are sometimes a requirement. But sometimes we introduce ...
13
votes
5answers
4k views
What's the best way to build a factory using NInject?
I am pretty comfortable with dependency injection using NInject in MVC3. While working in an MVC3 application, I developed a custom Controller Creation Factory using NInject, so any controller that is ...
5
votes
4answers
385 views
How do you motivate your team colleagues to learn, use and apply best practices? [duplicate]
Possible Duplicate:
How do you motivate peers to become better developers?
How do you promote and how do you assure that in your new project best practices like unit testing, TDD, ...
8
votes
2answers
740 views
design pattern for unit testing? [duplicate]
I am beginner in developing test cases, and want to follow good patterns for developing test cases rather than following some person or company's specific ideas. Some people don't make test cases and ...