title: Moq says Constructor arguments cannot be passed for interface mocks
body: <p>I have some problem with my tests for application ASP.NET MVC 5 like this</p>
  
  <blockquote>
    <p>Castle.Proxies.IdentityUserLogin: : EntityType 'IdentityUserLogin' has no key defined. Define the key for this EntityType.
    Castle.Proxies.IdentityUserRole: : EntityType 'IdentityUserRole' has no key defined. Define the key for this EntityType.
    IdentityUserLogins: EntityType: EntitySet 'IdentityUserLogins' is based on type 'IdentityUserLogin' that has no keys defined.
    IdentityUserRoles: EntityType: EntitySet 'IdentityUserRoles' is based on type 'IdentityUserRole' that has no keys defined.</p>
  </blockquote>
  
  <p>I tested UserService and I were using Moq and NUnit frameworks. I sovled all problems when I added this:</p>
  
  <pre><code>var mockContext = new Mock&lt;SomeContext&gt;() { CallBase = true };
  </code></pre>
  
  <p>but now I have this problem:</p>
  
  <blockquote>
    <p>Message: System.ArgumentException : Constructor arguments cannot be passed for interface mocks.</p>
  </blockquote>
  
  <p>If you want you can check my code below but I think problem only in "mockContext"</p>
  
  <pre><code>[Test, TestCaseSource(typeof(UserServiceTestData), nameof(UserServiceTestData.WrongCreateUserTestCases))]
      public void ShouldWrongUserCreationTest(UserDTO userDto)
      {
          //Arrange
          var user = new ApplicationUser
          {
              Email = "test",
              Roles = { new IdentityUserRole { UserId = "test", RoleId = "test" } },
              ClientProfile = new ClientProfile { Name = "test" }
          };
  
          var mockStore = new Mock&lt;IUserStore&lt;ApplicationUser&gt;&gt;();
          mockStore.Setup(x =&gt; x.FindByIdAsync(It.IsAny&lt;string&gt;())).Returns(Task.FromResult(user));
          mockStore.As&lt;IUserEmailStore&lt;ApplicationUser&gt;&gt;().Setup(x =&gt; x.FindByEmailAsync("existed")).Returns(Task.FromResult((ApplicationUser)null));
          mockStore.As&lt;IUserPasswordStore&lt;ApplicationUser&gt;&gt;();
          mockStore.As&lt;IUserRoleStore&lt;ApplicationUser&gt;&gt;().Setup(x =&gt; x.AddToRoleAsync(It.IsAny&lt;ApplicationUser&gt;(), It.IsAny&lt;string&gt;()))
              .Returns(Task.FromResult(IdentityResult.Success));
          mockStore.As&lt;IUserRoleStore&lt;ApplicationUser&gt;&gt;().Setup(x =&gt; x.GetRolesAsync(It.IsAny&lt;ApplicationUser&gt;()))
             .Returns(Task.FromResult((IList&lt;string&gt;)new List&lt;string&gt;()));
          mockStore.Setup(x =&gt; x.CreateAsync(It.IsAny&lt;ApplicationUser&gt;()))
              .Returns(Task.FromResult(IdentityResult.Success));
  
          var mockDbSet = new Mock&lt;DbSet&lt;ClientProfile&gt;&gt;(MockBehavior.Strict);
          mockDbSet.Setup(x =&gt; x.Add(It.IsAny&lt;ClientProfile&gt;())).Returns(new ClientProfile());
  
          var userManager = new ApplicationUserManager(mockStore.Object);
          var mockContext = new Mock&lt;AuthenticationContext&gt;() { CallBase = true };
          var mock = new Mock&lt;IIdentityUnitOfWork&gt;(mockContext.Object);
          mock.Setup(a =&gt; a.UserManager).Returns(userManager);
  
          //Act
          var userService = new UserService(mock.Object);
          OperationDetails result = userService.Create(userDto);
  
          //Assert
          Assert.That(result.Succedeed, Is.False);
      }
  </code></pre>