public void Populate( RecentComputerList computers ) { m_computers = computers; BeginUpdate(); this.Items.Clear(); this.Items.AddRange( computers.ToArray() ); this.MaxDropDownItems = Config.MaxComboItems; EndUpdate(); }
public void DuplicateAlias( ) { RecentComputerList computers = new RecentComputerList(); computers.Add( new ComputerName( "1.1.1.1", "work" ) ); computers.Add( new ComputerName( "2.2.2.2", "CASE" ) ); computers.Push( new ComputerName( "3.3.3.3", "work" ) ); // Alias is removed from the old item. Assert2.AssertComputerNames( new string[] { "3.3.3.3", "work", "1.1.1.1", null, "2.2.2.2", "CASE", }, computers.ToArray() ); // Confirm case sensitive. computers.Push( new ComputerName( "4.4.4.4", "case" ) ); Assert2.AssertComputerNames( new string[] { "4.4.4.4", "case", "3.3.3.3", "work", "1.1.1.1", null, "2.2.2.2", null, }, computers.ToArray() ); }
public void CopyCtor( ) { var computers = new RecentComputerList(); computers.Add( new ComputerName( "1.1.1.1", "work", true ) ); computers.Add( new ComputerName( "2.2.2.2", "home", false ) ); var otherComps = new RecentComputerList( computers ); // Did we copy? Assert.AreEqual( new ComputerName[] { new ComputerName( "1.1.1.1", "work", true ), new ComputerName( "2.2.2.2", "home", false ) }, otherComps.ToArray() ); // Are the underlying lists different objects? computers.Remove( computers.Find( "home" ) ); Assert.AreEqual( 1, computers.Count ); Assert.AreEqual( 2, otherComps.Count ); // Are the underlayng ComputerName different objects? foreach ( var name in computers ) { name.Alias = null; } Assert.IsNull( computers.Find( "work" ) ); Assert.IsNotNull( otherComps.Find( "work" ) ); }