title: One time setup no suitable constructor was found
body: <p>I am trying to unit test a class I have written which overrides the Authorization attribute. I am getting below error on this class. below is the code for the class.</p>
  
  <pre><code>namespace MyApplicationTests.Unit.Attribute
  {
      [TestFixture]
      public class CustomAuthorizeAttributeTests : AuthorizeCreditNote
      {
          private bool hasAccessOnRequestedData;
  
          public CustomAuthorizeAttributeTests(string Entity, string Key) : base(Entity, Key)
          {
          }
  
          [Test]
          public void CustomAuthorizeAttributes_ThrowNullArgumentException_WhenParametersAreMissing()
          {
  
          var authContext = new AuthorizationContext();
          string Entity = string.Empty;
          string Key = string.Empty;
          var attr = new AuthorizeCreditNote(Entity, Key);
  
          Assert.Throws&lt;Exception&gt;(() =&gt; attr.OnAuthorization(authContext));
          }
  
          [Test]
          public void CustomAuthorizeAttributes_ReturnFalse_IfContextUserDetailsAreNotBeingReviewed()
          {
              var parm1 = "TestParm1";
              var parm2 = "TestParm2";
              var attr = new AuthorizeCreditNote(parm1, parm2);
              Assert.AreEqual(attr.AllowMultiple, false);
  
          }
      }
  }
  </code></pre>
  
  <p>class which is being tested is as below..</p>
  
  <pre><code>namespace myApplication.Web.Supporting.Attributes.Finance
  {
      [AttributeUsageAttribute(AttributeTargets.Method, Inherited = true, AllowMultiple = false)]
      public class AuthorizeCreditNote : AuthorizeAttribute
      {
          protected string entity;
          public string Entity
          {
              get { return this.entity; }
          }
  
          protected string key;
          public string Key
          {
              get { return this.key; }
          }
  
          private bool hasAccessOnRequestedData;
  
  
          public string Value { get; set; }
          public AuthorizeCreditNote(string Entity, string key)
          {
              this.entity = Entity;
              this.key = key;
          }
  
          protected override bool AuthorizeCore(HttpContextBase httpContext)
          {
              hasAccessOnRequestedData = false;
              if (string.IsNullOrEmpty(Entity) || string.IsNullOrEmpty(Key))
                  throw new ArgumentNullException(entity == null ? entity : key);
  
              var isAuthorized = base.AuthorizeCore(httpContext);
              if (isAuthorized)
              {
                  var _customerContext = DependencyResolver.Current.GetService&lt;ICustomerContext&gt;();
  
                  if (Entity == AttributeHelper.CreditNote.Entity)
                  {
                      var entityKeyValue = HttpContext.Current.Request.Params[key];
                      var entityReader = DependencyResolver.Current.GetService&lt;ICreditReader&gt;();
  
                      if (entityReader != null)
                      {
                          var entityResult = entityReader.Get(entityKeyValue.ToString());
  
                          var expectedCustomerNumber = _customerContext.LoggedInCustomer.MasterAccount?.CustomerNumber ?? _customerContext.LoggedInCustomer.CustomerNumber;
                          hasAccessOnRequestedData = (expectedCustomerNumber == entityResult.CustomerNumber) ? true : false;
                          return hasAccessOnRequestedData;
                      }
  
                      return true;
                  }
              }
              return hasAccessOnRequestedData;
          }
      }
  }
  </code></pre>
  
  <p>I ma getting below error while running the test:</p>
  
  <blockquote>
    <p>One time setup no suitable constructor was found.</p>
  </blockquote>