When creating a product, its reliability and quality is always important, especially when the product is a software. The software is much more reliable if we’ve tried all its functions, before releasing it, eliminating all the bugs in the released version. One way of doing this is the more fully test of the software. It’s a good idea to automatize the test, to make it repeatable anytime.
But the best way to test a program is not always obvious, for example when the result of the currently tested function depends on the effect of an other. If we want to fully test the function, then we have to know how the other works, and this makes the test more complicated. Another question comes up when we are testing data-driven applications, which is the usage of the database. While developing and testing the application, the database could change, thus the tests always have to be updated for the actual state. There are several different methods being used to test the parts of, or the whole application.
In this paper I’ve searched for new and effective solutions for the problems mentioned above, generally and specifially within the .NET framework. I also examined how I should develop the architecture of an application, so the solutions I’ve found can be usable easier and more effectively. At last, I present the ASP.NET web application I’ve developed, in which, while developing and testing the program, I’ve applied all the things I’d learned,.
In this paper I also describe the Dependency Injection software desing pattern, which is greatly helps preparing the architecture of the application for testing. I also describe Ninject, which is an implementation of the Dependency Injection in the .NET framework. With Ninject it is easy to replace the implemented classes with test doubles, and so the functions became isolately testable. For creating the test doubles I used the method of „mocking”, with the Moq library. I also describe the OWIN interface I’ve used for running the whole application within a test method.