protected override void Execute() { var projectsFilter = new string[0]; if (projects.Count > 0) { Log.Debug("Loading projects..."); projectsFilter = Repository.Projects.FindByNames(projects.ToArray()).Select(p => p.Id).ToArray(); } var environmentsById = new Dictionary <string, string>(); if (environments.Count > 0) { Log.Debug("Loading environments..."); CollectionExtensions.AddRange(environmentsById, Repository.Environments.FindByNames(environments.ToArray()).Select(p => new KeyValuePair <string, string>(p.Id, p.Name))); } else { CollectionExtensions.AddRange(environmentsById, Repository.Environments.FindAll().Select(p => new KeyValuePair <string, string>(p.Id, p.Name))); } var deployments = Repository.Deployments.FindAll(projectsFilter, environments.Count > 0 ? environmentsById.Keys.ToArray() : new string[] {}); foreach (var deployment in deployments.Items) { LogDeploymentInfo(deployment, environmentsById); } }
public void MultipleActionsWithoutSuspendingNotifications() { var counter = 0; var fastCollection = new FastObservableCollection <int>(); fastCollection.AutomaticallyDispatchChangeNotifications = false; fastCollection.CollectionChanged += (sender, e) => counter++; fastCollection.Add(0); fastCollection.Add(1); fastCollection.Remove(0); fastCollection.Remove(1); CollectionExtensions.AddRange(((ICollection <int>)fastCollection), new[] { 1, 2 }); fastCollection[0] = 5; fastCollection.Move(0, 1); fastCollection.Clear(); Assert.AreEqual(9, counter); }
static void DoPropagate(ILVariable v, ILInstruction copiedExpr, Block block, ref int i, ILTransformContext context) { context.Step($"Copy propagate {v.Name}", copiedExpr); // un-inline the arguments of the ldArg instruction ILVariable[] uninlinedArgs = new ILVariable[copiedExpr.Children.Count]; for (int j = 0; j < uninlinedArgs.Length; j++) { var arg = copiedExpr.Children[j]; var type = context.TypeSystem.Compilation.FindType(arg.ResultType.ToKnownTypeCode()); uninlinedArgs[j] = new ILVariable(VariableKind.StackSlot, type, arg.ResultType, arg.ILRange.Start) { Name = "C_" + arg.ILRange.Start }; block.Instructions.Insert(i++, new StLoc(uninlinedArgs[j], arg)); } CollectionExtensions.AddRange(v.Function.Variables, uninlinedArgs); // perform copy propagation: foreach (var expr in v.LoadInstructions.ToArray()) { var clone = copiedExpr.Clone(); for (int j = 0; j < uninlinedArgs.Length; j++) { clone.Children[j].ReplaceWith(new LdLoc(uninlinedArgs[j])); } expr.ReplaceWith(clone); } block.Instructions.RemoveAt(i); int c = ILInlining.InlineInto(block, i, aggressive: false, context: context); i -= c + 1; }
public static void AddRange___Should_throw_ArgumentNullException___When_parameter_collection_is_null() { // Arrange var valuesToAdd = new List <int>(); // Act, Assert Assert.Throws <ArgumentNullException>(() => CollectionExtensions.AddRange(null, valuesToAdd)); }
public void TestAddRange() { var people = new System.Collections.Generic.List <PersonProper>(); CollectionExtensions.AddRange <PersonProper>(people, base.personProperCollection.PickRandom(base.CollectionCount / 2), true); base.Consumer.Consume(people.Count); }
public void CollectionExtensions_AddRange_EmptyItemsCollection() { List <int> list = new List <int> { 1, 2 }; CollectionExtensions.AddRange(list, new int[0]); Assert.Equal(2, list.Count); }
public void CollectionExtensions_AddRange_ItemsAdded() { List <int> list = new List <int> { 1, 2 }; CollectionExtensions.AddRange(list, new int[] { 3, 4 }); Assert.Equal(4, list.Count); Assert.Equal(3, list[2]); Assert.Equal(4, list[3]); }
protected bool SendInfo(string data, List <SignalingHeader> headers) { base.DebugTrace("Inside LocalConnectivityTester SendInfo()", new object[0]); bool result; lock (this) { try { if (base.IsCallGone()) { base.Error = new TUC_RemoteEndDisconnected(); result = false; } else { this.sipInfoEvent = new ManualResetEvent(false); ContentType contentType = new ContentType("text/plain"); ContentDescription contentDescription = new ContentDescription(contentType, data); CallSendMessageRequestOptions callSendMessageRequestOptions = new CallSendMessageRequestOptions(); if (headers != null) { CollectionExtensions.AddRange <SignalingHeader>(callSendMessageRequestOptions.Headers, headers); } base.AudioCall.EndSendMessage(base.AudioCall.BeginSendMessage(1, contentDescription, callSendMessageRequestOptions, null, null)); base.DebugTrace("Inside LocalConnectivityTester SendInfo: sent SIPINFO", new object[0]); result = true; } } catch (Exception ex) { if (!(ex is RealTimeException) && !(ex is InvalidOperationException)) { throw; } base.Error = new TUC_SendSequenceError(ex.Message, ex); base.ErrorTrace("Inside LocalConnectivityTester SendInfo, error ={0}", new object[] { ex.ToString() }); result = false; } } return(result); }
public void ThrowsArgumentNullExceptionForNullCollection() { var newList = new List <int> { 4, 5, 6 }; ExceptionTester.CallMethodAndExpectException <ArgumentNullException>(() => CollectionExtensions.AddRange(null, newList)); }
public void CollectionExtensions_AddRange_NullItemsCollection() { Assert.Throws <ArgumentNullException>(() => CollectionExtensions.AddRange <int>(new List <int>(), null)); }
public void CollectionExtensions_AddRange_NullSourceCollection() { Assert.Throws <ArgumentNullException>(() => CollectionExtensions.AddRange <int>(null, new int[0])); }
public void WhenSourceIsNull_ThenThrowException() { Assert.Throws <ArgumentNullException>(() => CollectionExtensions.AddRange(null, CollectionToAdd)); }