コード例 #1
0
        /// <inheritdoc/>
        public override MethodResult Execute(object testClass)
        {
            if (testClass != null)
            {
                throw new InvalidOperationException("testClass is unexpectedly not null");
            }

            var dependencyResolver = ContainerResolver.GetDependencyResolver(testMethod.Class.Type);

            using (var lifetimeScope = dependencyResolver.CreateScope())
            {
                testClass = lifetimeScope.GetType(testMethod.Class.Type);
                return(_wrapper.Execute(testClass));
            }
        }
コード例 #2
0
        public MethodResult Execute(object testClass)
        {
            var parameters = MethodInfo.GetParameters();

            if (parameters == null || parameters.Length == 0)
            {
                return(_testCommand.Execute(testClass));
            }
            else
            {
                var dependencyResolver = ContainerResolver.GetDependencyResolver(Class.Type);
                var arrparameters      = new object[parameters.Length];
                for (int i = 0; i < parameters.Length; i++)
                {
                    arrparameters[i] = dependencyResolver.GetType(parameters[i].ParameterType);
                }
                Invoke(testClass, arrparameters);
                return(new PassedResult(_method, DisplayName));
            }
        }