Interested in a private company training? Request it here.
Every developer want clean code that works. So how does one get to maintainable and working code? And moreover: keep it working.
When Unit Testing, you will have to decide on frameworks. There are several ones out there, which one do I need? Visual Studio comes with a built in framework called MSTest, but you also have others, like the popular XUnit. In this module, we will discuss pros and cons of these frameworks, and go into some best practices. How do I know if I have tested enough? With code coverage you can see which paths in your code you have tested, and easily discover untested conditional logic.
When writing code, you have to make sure you are not introducing unnecessary dependencies on other objects. Dependencies will just cost you on the long run since they are harder to maintain, not easily testable, exchangeable, ... . If you need to depend on another, then depend on the interface. Interfaces describe the dependency, but do not force it. Now, you don't want those dependencies to be filled hard coded and this is where dependency injection (DI) can help you. Dependency injection can help you at runtime dynamically deciding which implementations to plug into the dependencies.
If you want your code to be testable, you have to engineer your code for testing. You will learn about Stubs and Mocks, and how to replace dependencies that might interfere with testing.
Building Stubs and Mocks can be a lot of work without an Isolation Framework. MOQ is an isolation framework that allows you to easily build the Fake objects you need for building great tests. And how do you test 'untestable' code? Code where dependencies have been glued into the class you want to test? Then you need some magic: Microsoft Fakes. This product allows you to replace any class's implementation, making it easier to test legacy code and other difficult to test code.
When creating modern web applications with ASP.NET MVC, it's not that straightforward to unit test the Controllers and Views. How does one validate whether the ActionResult returned by the Controller action is the one you wanted, as well as whether the View is correct.
So your software works! Great! But how do you know if it will work next week, or next month? Did you break something adding some new cool feature? Test everything again? Of course, but now we will make a machine do it automatically every time a team member makes a change.
Writing solid, maintainable code that works. This is what every developer wants. This course guides you into the art of unit testing, where you learn to build testable code and various techniques to give your code a good spin. With unit testing, comes unit testing frameworks. We'll discuss how unit testing frameworks work and how they help you. Frameworks that will be considered are MSTest and XUnit. Of course we will also observe the need for Fake, Stub and Mock objects. Once you have your unit tests ready you will want to run them automatically, for example to do regression testing, using Continuous Integration. At the end of this course you will go home with a solid and practical understanding of unit testing and how to apply this in real life. U2U is known for its real-life approach to training, so each chapter is accompanied with lots of hands-on labs.
This course is intended for experienced programmers who are very familiar with VB.NET or C# and have a working experience with .NET.