More Related Content Similar to Unit Testing 101 (20) More from Dave Bouwman (13) Unit Testing 1011. You need
some tests yo!
Dave Bouwman // CTO // DTSAgile
29. Private void ButtonOn_Click(){
//read values from controls
//apply business logic
//send changes to DAL
//connect to database
//update data
//update interface
}
31. user interface WPF/Silverlight
objects
business
objects
unit
tests
data access
objects
37. 1
created
by the
constructor
38. private IAccountRepository _accountRepository;
private IFormsAuthentication _formsAuthentication;
private ILogService _logger;
public AccountController()
{
_accountRepository =
new AccountRepository(_connectionString);
_logger = new Logger();
_formsAuthentication = new FormsAuthentication();
}
44. 2 pass
dependencies
into the
constructor
46. private IAccountRepository _accountRepository;
private IFormsAuthentication _formsAuthentication;
private ILogService _logger;
public AccountController(IAccountRepository accountRepository,
IFormsAuthentication formsAuthentication,
ILogService logger)
{
_accountRepository = accountRepository;
_formsAuthentication = formsAuthentication;
_logger = logger;
}
51. Castle Windsor
Spring.NET
mvccontrib IoC
StructureMap
Unity
http://mvccontrib.codeplex.com
61. rhinomocks
http://ayende.com/projects/rhino-mocks.aspx
69. in
ArcMap
Business
IEditEvents Shim
Logic
ArcMap
81. testable
classes
IServerObjectExtension
COM COM
SOE
Utility Utility
(ArcObjects) (ArcObjects)
86. http://mbunit.com
http://testdriven.net
resources http://ASP.NET/mvc
http://mvccontrib.codeplex.com
http://castleproject.org
http://ayende.com/projects/rhino-mocks.aspx