Click here to Skip to main content
15,881,687 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
below is my repository service
C#
public class ProductService : IProductService {

   private IProductRepository _productRepository;

   // Some initlization stuff

   public Product GetProduct(int id) {
      try {
         return _productRepository.GetProduct(id);
      } catch (Exception e) {
         // log, wrap then throw
      }
   }
}

and also i have a user defined form interface service as below:
C#
 public interface IFormService
{
        Form GetFormById(int formId);
        Form GetFormByName(string formName);
        bool AddElement(FormElement form);
        bool AddForm(Form form);
}

now the constructor to the controller passes values as below:
C#
public ProductController(IProductService productService , IFormService fwrepository)
        {
            this.productService = productService;
            this.fwrepository = fwrepository;
         }


how can i mock the two attributes while unit testing??
Please help
Posted
Updated 21-Feb-13 17:24pm
v2

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