Skip to main content

All Questions

Filter by
Sorted by
Tagged with
1 vote
1 answer
104 views

Decoupling of validation and data access in ASP.NET

I've been asigned to a project no dev has touched in a long time. It's an ASP.NET MVC 4 application. It appeared to be well coded, but had no testing and the database migration folder is not present. ...
Peter's user avatar
  • 165
3 votes
1 answer
3k views

Implementing integration tests in ASP.NET core using InMemory database

I am building a web application using ASP.NET core. Most of the tests in my application are unit tests, so I mocked every dependencies in order to have fast unit tests. On the other hand I am of the ...
mirind4's user avatar
  • 299
6 votes
1 answer
655 views

Unit test for a CreateUser() method using JustMock lite

I'm new to unit testing and have created a unit test for a create user action method and it's passing the test. I'm not sure if this is the right way to unit test a create method. This is my test ...
Satvinder Singh's user avatar
4 votes
1 answer
3k views

Dynamic wrappper used to unit test ASP.NET Core MVC Controllers that return anonymous objects

Originally created for this answer on SO, I thought there was still room for improvement on the initial basic idea. Also thought about using an extension method to make using syntax simpler. Here is ...
Nkosi's user avatar
  • 3,286
7 votes
2 answers
4k views

Expose an IDbSet<> object to overcome a limitation for LINQ's Select()

Before posting this, I have spent the past 4 days tirelessly investigating the Internet and the different Stack Exchange websites on how to correctly implement the Unit of Work pattern and Unit Test ...
Jose A's user avatar
  • 203
12 votes
1 answer
38k views

Unit testing with dependency injection and MOQ

I'm just learning how dependency injection and mocking work, but I'd like some feedback on how I'm setting up a couple of tests. I can get them to pass, but I'm not sure this is all I need. This is ...
madvora's user avatar
  • 221
5 votes
1 answer
226 views

Controller that uses a tested repository (or service)

I have a repository called PostsRepository who implements an interface called IPostsRepository: ...
Caster Troy's user avatar
15 votes
2 answers
5k views

Repository and Controller tests

Lately I have been researching how to best unit test an EF repository and given a properly tested repository, what to test in the controller. My research did not reveal many sound examples or ...
Caster Troy's user avatar
6 votes
2 answers
316 views

Repository implementation

I have a repository called PostsRepository: ...
Caster Troy's user avatar
4 votes
2 answers
132 views

Best testing using a mocked repository

...
Caster Troy's user avatar
17 votes
1 answer
299 views

Naming for unit tests for controller to edit posts

I am relatively new to TDD and am trying to adopt better names for my tests. I wrote the following tests abruptly and have since refactored them to the best of my ability, but despite my best ...
User 12345678's user avatar