protected AutoMockBaseClass() { var ctor = typeof(TTarget).GetConstructors().First(x => x.IsPublic); _mocks = MockHelper.CreateMocks(ctor); CancellationToken = It.IsAny <CancellationToken>(); var arguments = _mocks.Select(kp => { if (kp.Key == typeof(IMapper)) { return(Mapper); } return(kp.Value.Object); }).ToArray(); Target = (TTarget)ctor.Invoke(arguments); }