Click here to Skip to main content
15,074,181 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi, here i am trying to understand how i can write unite test for my web api controller methode.As i am new to this i was gone through enough articles but that made me more confused stage.
 
I have a StudentController in my api.Which will take a bunch of student details as input and will return some other details.Butlater in my controller post methode input type may be automaticaly come,like from any pipeline call or any api..but the model format is diffrent and i want to test that kind using unit test.

<pre>In Unit test i have to check how i can pass diffrent type of input style. that is like
 
var student=new student
{
name="Tom"
class="5B"
Id="S99" 
} ,
 
var Home=new home
{
Fathername="GeorgeTom"
Mothername="carla"
houseno="H23"
}
 
...
i need to pass this kind of input and test in unit test .May be i have to change this to json object and pass.But i want to find the possibiliteis of passing these kind of input model using unit test.
 
where i have to start?
 
How I can pass this model? 
 
 
Thanks a lot!!!


What I have tried:

I have created one Unittest solution and added teststudent controller
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900