locked
Valuable Assistance For Unit Testing Controllers. RRS feed

  • Question

  • I'm developing an application that is structured using different layers of different projects namely the Web Application Layer(this is a Complete MVC application projects with Controllers and Views),Service Layer(this is where the Repository methods are being done),Business Logic Layer(this is the which performs logic by calling repository methods),the Data Access Layer(the layer which responsible for Making access to data base classes and making some configurations for connections to the database) and Finally the Model Layer(which is responsible for displaying information in a view).

    The problem lies when I create some unit tests for controller methods.For example when I unit test the Index Method for which I have to call out the method from a business logic, perform a list method based on a model class I receive a message which states   " Object not set to Instance of an object".Is there a valuable way I can unit test controller methods when I am depending on business methods?

    Wednesday, July 22, 2015 1:27 PM

All replies

  • Hi,

    Thank you for posting in MSDN forum.

    >>"Object not set to Instance of an object".

    From this error message, I assume that you may be not instance of an object for the specified object in your unit test method .

    So I suggest you could try to run your unit test method using debug method to check where you get this error message.

    Since we have not the same sample, so we are not reproduce your issue in my side. Therefore, I suggest you could share the mainly code about this unit test method for this MVC application.

    Thanks,


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Friday, July 24, 2015 6:35 AM