title: Mocking a method which is in the same class in C#
body: <p>my code goes like this I am trying to mock the htttputility urlencode method which I am using in GetUrlToSurveyMonkeyAuthentication method.</p>
  
  <pre><code>    //this is the method which uses urlencode method which is in the same class
      public string GetUrlToSurveyMonkeyAuthentication(string redirectUri, string clientId, string apiKey)
      {
          string urlToOauthSurveyMonkeyAuthentication = SurveyMonkeyBaseUrl + AuthCodeEndUrl + ParameterSeparator + ParameterRedirectUriName + UrlEncodes(redirectUri) + ParameterAdditioner + ParameterClientIdName + UrlEncodes(clientId) + ParameterAdditioner + ParameterResponseTypeName + UrlEncodes(ResponseType) + ParameterAdditioner + ParameterAPIKeyname + UrlEncodes(apiKey);
          return urlToOauthSurveyMonkeyAuthentication;
      }
      // my urlencode method which needs to be mocked it is in the same class SurveyMonkeyAPIService
      public virtual string UrlEncodes(string value)
      {
          return HttpUtility.UrlEncode(value);
      }
  </code></pre>
  
  <p>my test method goes like this </p>
  
  <pre><code>     [Test]
      public void GetUrlToSurveyMonkeyAuthenticationTest()
      {
          var mockUrlEncodeMethod = new Moq.Mock&lt;ISurveyMonkeyAPIService&gt;();
          mockUrlEncodeMethod.CallBase = true;
          mockUrlEncodeMethod.Setup(x =&gt; x.UrlEncode(It.IsAny&lt;string&gt;())).Returns(TestData.TestData.SamplehttpUtilityURLEncodeMockString);
          string tempURL = mockUrlEncodeMethod.Object.GetUrlToSurveyMonkeyAuthentication(TestData.TestData.SampleRedirectUri, TestData.TestData.SampleClientId, TestData.TestData.SampleApiKey);
          Assert.IsNotNullOrEmpty(tempURL);
      }
  </code></pre>
  
  <p>my test fails it always returnsnull value , I have tried removing the virtual keyword , I have an interface which has these two method definitions, I have no parameter constructor.I am using Nunit to test these methods. </p>