title: How do i mock a another method which is called in controller action?
body: <p>Here I have one scenario in which i have to call another function in my controller action for some input purpose.
  as below.</p>
  
  <pre><code>public IActionResult Dashboard()
          {
              try
              {
                      var allStuds = repository.GetAllStudentss();
                      var result = getFirstClassResult(allStuds);
                      return View("Dashboard", result );                         
              }
              catch (Exception ex)
              {             
                  return View();
              }
          }
  
  
   public List&lt;DashboardViewModel&gt; getFirstClassResult(List&lt;DashboardViewModel&gt; model)
          {
        return students.OrderByDescending(x=&gt;x.ExamDate).ToList();
      }
  </code></pre>
  
  <p>here is code inside my tets case.</p>
  
  <pre><code>var controller = new StudentController(repositoryMock.Object, null, sessionManagerMock.Object);
      var date = new DateTime();
      var model= new List&lt;DashboardViewModel&gt;          
      controller.ControllerContext.HttpContext = GetHttpContext(CreateSessionMock(true), authenticationServiceMock);
      controller.TempData = new TempDataDictionary(controller.ControllerContext.HttpContext, Mock.Of&lt;ITempDataProvider&gt;());
      controller.Url = GetUrlHelper();
      contextMock.Setup(mock =&gt; mock.GetAllStudents()).Returns(model);
      var repository = new StudentRepository(factoryMock.Object);
      var res = repository.GetAllStudents();                
      var result = controller.Dashboard() as ViewResult;
      Assert.Equal("Dashboard", result.ViewName);
  </code></pre>
  
  <p>and here i am writting test case in which I have to mock <code>getFirstClassResult(allStuds)</code> method.
  which am unable to do.</p>