title: Autofac.ILifetimeScope: Not able to Mock or resolve my service class
body: <p>I have created a test project for service layer in my application and everything is working fine, but I need to Mock one of my service class which exists in some other folder or namespace but the same solution. So I tried like following to Mock the service class (IEmailService), but while calling the 'ResolveServiceInstance' function, it goes to 'TearDown'(attribute) method to dispose the container/object of Autofac.ILifetimeScope. I don't know where I did go wrong, please help me with this.</p>
  
  <p>My 'SetUp' Method for Mock the service class,</p>
  
  <pre><code>public ILifetimeScope Container { get; private set; }
  
  [SetUp]
  public void SetUpTest()
  {
      MockPermissionService = new Mock&lt;IPermissionService&gt;();
      MockPermissionServiceProvider = new Mock&lt;IPermissionServiceProvider&gt;();
      MockPlatformEmailService = new Mock&lt;Platform.Services.IEmailService&gt;();
      Container = ServiceTestsSetUp.GlobalContainer.BeginLifetimeScope(builder =&gt;
      {
          builder.Register(c =&gt; MockPermissionService.Object).As&lt;IPermissionService&gt;();
          builder.Register(c =&gt; MockPermissionServiceProvider.Object).As&lt;IPermissionServiceProvider&gt;();
          PreServiceResolve(builder);
      });
  
      Service = ResolveServiceInstance();
      AddStaticData();
  } 
  </code></pre>
  
  <p>My ResolveServiceInstance function,</p>
  
  <pre><code>private TService ResolveServiceInstance()
  {
     return Container.Resolve&lt;TService&gt;();
  }
  </code></pre>
  
  <p>When it returns the container.Resolve method it shows the below error message, so I am not able to register or mock the other namespace class. What I did wrong here?</p>
  
  <pre><code> DependencyResolutionException: None of the constructors found with 'Autofac.Core.Activators.Reflection.DefaultConstructorFinder' on type 'InEight.Platform.Services.EmailService' can be invoked with the available services and parameters:
   Cannot resolve parameter 'InEight.Platform.TenantInfo tenant' of constructor 'Void .ctor(InEight.Platform.TenantInfo, InEight.Platform.Site.Services.Contexts.ICoreDataContext, InEight.Platform.Logs.IAppLog)'.    
  </code></pre>