TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Sujeet Raman
752
927
354.1k
How to write a unittest for a controller methode in .NET core?
May 19 2021 2:59 PM
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
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!!!
Reply
Answers (
1
)
Add column values of a excel using c# & spire.xls
Why Can't read an image by URL path in the .Net Core 2.1 Application?