Tagged Questions
1
vote
4answers
36 views
How to unit test a service which uses caching?
I have a service layer, which has a range of methods. These methods have implemented caching, like the following:
string key = "GetCategories";
if (CacheHandler.IsCachingEnabled() && ...
0
votes
1answer
32 views
Which layer should I test in an n-tier application
I have a 4 tier application
1) Presentation (MVC)
2) Service (WCF)
3) Business
4) Data
Some methods in my service layers perform a lot of other sub processes for e.g.,
public OrderResponse ...
1
vote
2answers
43 views
MVC + EF DB-First Unit Testing
I am wondering whether Unit Testing is possible if I use a DB-First Entity Framework model -- or shall I rather do Integrity Tests only? Can I detach the system from the DB while testing?
I already ...
0
votes
2answers
33 views
Include ModelState.IsValid in controller unit test?
I have the following controller:
public ActionResult Login(LoginUseraccount loginUseraccount)
{
try
{
if (ModelState.IsValid)
{
//Do something
return ...
0
votes
0answers
10 views
Unit test RedirectToRouteResult
I have the following code in my controller:
public class MyController : BaseController
{
public ActionResult MyMethod()
{
...
return RedirectToAction("Index", "Dashboard");
...
0
votes
2answers
31 views
Assert statement to compare two files for equality
I am writing from one file to another and i created an Assert statement in my tests to check and see if the new file equals the original file but was not sure what is the best way to go about it. I ...
-2
votes
0answers
25 views
How to create unit test for a MVC project in visual studio
I created a simple MVC project .I wanna create unit test for a controller in that.That particular controller retrieves data from database and send it to the view. How to create unit test to check ...
0
votes
3answers
80 views
Starting Big Project With Test Driven Development
I have a model for my project like that shown in the following diagram. I planned the project using Domain Driven Design and development style is Test Driven Development. And layers are as following.
...
1
vote
1answer
41 views
How to test with any integer
Is there something I can replace the '1' with as a wildcard (any number greater than 0) so that for anything passed in this always returns the same thing etc?
[TestMethod]
public void ...
1
vote
1answer
39 views
How to test JsonResult from .NET MVC controller
Here's my controller method:
[AuthorizeUser]
[HttpPost]
[ValidateJsonAntiForgeryToken]
public ActionResult EventDetails(int eventId)
{
string details = ...
0
votes
0answers
18 views
Issue unit testing an asp.net MVC controller that inherits from a custom base controller
So i'm using Moq and starting to write unit tests for my controller actions.
All of my controllers inherit from a base CustomController class that provides a userId property set in the constructor ...
0
votes
2answers
48 views
Testing the Account Controller
There are surprisingly very few search-engine results for this, but I wanted to know what are the best ways to go about unit testing the Account Controller when using ASP.NET MVC4?
1
vote
1answer
32 views
how can I test method from service when I use unit of work and repository pattern
How can I test ClassifyComment() method from my service. I have that test code:
[TestClass]
public class SpamServiceTest
{
[TestMethod]
public void ClassifyCommentTest()
{
var ...
1
vote
1answer
71 views
Need to choose assertion for unit test? [closed]
This is my code:
public int GetTotalIssuedCount()
{
var storeCode = Store.Current.Code.ToLower();
return (from i in Context.Instance.EduContainer.IssueDetailsSet
where ...
0
votes
0answers
67 views
ASP.NET Web Api - testing Post method with writing to text file
This is my Post method which gets information about phone and return offer for this phone (for now it's just basic):
public ActionOffer Post(MobileInformation mobileInfo)
{
var ...