public void Prepend( IEnumerable<object> sut, object[] items )
		{
			var prepended = sut.Prepend( items );
			Assert.Equal( sut.Count() + items.Length, prepended.Count() );
			Assert.True( sut.All( x => prepended.Contains( x ) ) );
			Assert.True( items.All( x => prepended.Contains( x ) ) );
		}
Example #2
0
 /// <summary>
 /// Builds this project, using the default targets and the given loggers.
 /// </summary>
 /// <param name="loggers">An enumerator over all loggers to be used during the build.</param>
 /// <returns>
 /// Returns true on success; false otherwise.
 /// </returns>
 public bool Build(IEnumerable<ILogger> loggers)
 {
     var result = false;
     this.SwapMSBuildTasks();
     using (var reader = this.Document.CreateReader())
     {
         reader.MoveToContent();
         var innerProject = new Microsoft.Build.Evaluation.Project(reader);
         result = innerProject.Build(loggers.Prepend(this.Logger));
         reader.Close();
     }
     return result;
 }
Example #3
0
 internal Expression InvokeDynamicMember(Expression memberNameExpr,
                                                PSMethodInvocationConstraints constraints,
                                                Expression target,
                                                IEnumerable<Expression> args,
                                                bool @static,
                                                bool propertySet)
 {
     var binder = PSInvokeDynamicMemberBinder.Get(new CallInfo(args.Count()), _memberFunctionType, @static, propertySet, constraints);
     return DynamicExpression.Dynamic(binder, typeof(object), args.Prepend(memberNameExpr).Prepend(target));
 }
Example #4
0
 private Expression InvokeBaseCtorMethod(PSMethodInvocationConstraints constraints, Expression target, IEnumerable<Expression> args)
 {
     var callInfo = new CallInfo(args.Count());
     var binder = PSInvokeBaseCtorBinder.Get(callInfo, constraints);
     return DynamicExpression.Dynamic(binder, typeof(object), args.Prepend(target));
 }
Example #5
0
 internal Expression InvokeMember(string name,
                                  PSMethodInvocationConstraints constraints,
                                  Expression target,
                                  IEnumerable<Expression> args,
                                  bool @static,
                                  bool propertySet)
 {
     var callInfo = new CallInfo(args.Count());
     var classScope = _memberFunctionType != null ? _memberFunctionType.Type : null;
     var binder = name.Equals("new", StringComparison.OrdinalIgnoreCase) && @static
         ? (CallSiteBinder)PSCreateInstanceBinder.Get(callInfo, constraints, publicTypeOnly: true)
         : PSInvokeMemberBinder.Get(name, callInfo, @static, propertySet, constraints, classScope);
     return DynamicExpression.Dynamic(binder, typeof(object), args.Prepend(target));
 }
Example #6
0
 internal static Expression InvokeMember(string name, PSMethodInvocationConstraints constraints, Expression target, IEnumerable<Expression> args, bool @static, bool propertySet)
 {
     return Expression.Dynamic(PSInvokeMemberBinder.Get(name, new CallInfo(args.Count<Expression>(), new string[0]), @static, propertySet, constraints), typeof(object), args.Prepend<Expression>(target));
 }