public Page1() { this.InitializeComponent(); ((DataSourceAdapter)chart.Series[0].Data).DataSource = data; rangeY.StartValue = 18.0; // minData - minData * 0.0002; rangeY.EndValue = 25.0; // MaxData + MaxData * 0.0002; data.Clear(); try { _sensor = new SensorHelper(); StatusText.Text = _sensor.Message; //StartProcess(); // Start(); } catch (Exception ex) { StatusText.Text = ex.Message; } // periodicTimer = new Timer(this.Timer_Tick, null, 0, 1000); timer = new DispatcherTimer() { Interval = new TimeSpan(0, 0, 0, 0, 1000) }; timer.Tick += OnTimerTick; // receiveTimer = new Timer(this.Receive_Timer_Tick, null, 0, System.Threading.Timeout.Infinite); Loaded += OnLoaded; Unloaded += MainPage_Unloaded; }
public static void TestClear() { MyCollection collBase = CreateCollection(100); collBase.Clear(); Assert.Equal(0, collBase.Count); }
public void CollectionChangedWithResetShouldShowItems() { var count = 10; ManualForm($"GridView should show {count} items", form => { var collection = new MyCollection(); var filterCollection = new FilterCollection <DataItem>(collection); var myGridView = new GridView { Size = new Size(200, 260), DataStore = filterCollection, Columns = { new GridColumn { DataCell = new TextBoxCell{ Binding = Eto.Forms.Binding.Property((DataItem m) => m.Id.ToString()) } } } }; collection.Clear(); collection.AddRange(Enumerable.Range(1, count).Select(r => new DataItem(r))); return(myGridView); }); }
public void ClassImplementingICollectionCastToICollectionClearWorks() { ICollection <string> c = new MyCollection(new[] { "x", "y" }); c.Clear(); Assert.AreEqual(0, c.Count); }
public void ClassImplementingICollectionRemoveWorks() { MyCollection c = new MyCollection(new[] { "x", "y" }); c.Clear(); Assert.AreEqual(c.Count, 0); }
public void ClearTest() { var col = new MyCollection(10); col.Clear(); Assert.AreEqual(0, col.Length); }
public void RefillMyCollection(IEnumerable <string> values) { MyCollection.Clear(); foreach (string value in values) { MyCollection.Add(value); } }
public void ClearTest() { var list = new MyCollection<char>(); list.Add('A'); list.Add('B'); list.Add('C'); list.Add('D'); Assert.True(list.Count == 4); list.Clear(); Assert.True(list.Count == 0); }
public void Clear() { AllocateWithSingle <object>(out var MyCollection, out var MyObject, 0); GC.Collect(); Assert.AreEqual(1, MyCollection.Count(), "Item was not added"); MyCollection.Clear(); Assert.AreEqual(0, MyCollection.Count(), "Item was not removed"); GC.KeepAlive(MyObject); }
public static void Main() { // Creates and initializes a new MyCollection that is read-only. IDictionary d = new ListDictionary(); d.Add("red", "apple"); d.Add("yellow", "banana"); d.Add("green", "pear"); MyCollection myROCol = new MyCollection(d, true); // Tries to add a new item. try { myROCol.Add("blue", "sky"); } catch (NotSupportedException e) { Console.WriteLine(e.ToString()); } // Displays the keys and values of the MyCollection. Console.WriteLine("Read-Only Collection:"); PrintKeysAndValues(myROCol); // Creates and initializes an empty MyCollection that is writable. MyCollection myRWCol = new MyCollection(); // Adds new items to the collection. myRWCol.Add("purple", "grape"); myRWCol.Add("orange", "tangerine"); myRWCol.Add("black", "berries"); Console.WriteLine("Writable Collection (after adding values):"); PrintKeysAndValues(myRWCol); // Changes the value of one element. myRWCol["orange"] = "grapefruit"; Console.WriteLine("Writable Collection (after changing one value):"); PrintKeysAndValues(myRWCol); // Removes one item from the collection. myRWCol.Remove("black"); Console.WriteLine("Writable Collection (after removing one value):"); PrintKeysAndValues(myRWCol); // Removes all elements from the collection. myRWCol.Clear(); Console.WriteLine("Writable Collection (after clearing the collection):"); PrintKeysAndValues(myRWCol); }
public static void Main() { // Creates and initializes a new MyCollection instance. IDictionary d = new ListDictionary(); d.Add("red", "apple"); d.Add("yellow", "banana"); d.Add("green", "pear"); MyCollection myCol = new MyCollection(d); Console.WriteLine("Initial state of the collection (Count = {0}):", myCol.Count); PrintKeysAndValues(myCol); // Removes all elements from the collection. myCol.Clear(); Console.WriteLine("After clearing the collection (Count = {0}):", myCol.Count); PrintKeysAndValues(myCol); }
public void Clear_ThityItemsInArray_EmptyCollection() { // Arrange var random = new Random(); var count = 30; var collection = new MyCollection <string>(); for (var i = 0; i < count; i++) { collection.Add(random.Next(10000).ToString()); } // Act collection.Clear(); // Assert Assert.Empty(collection); }
public void WorkCollectionInheritedClasses() { Student firstStudent = new Student("Alina", "Kylish", 123456789, new DateTime(1988, 4, 3)); Student secondStudent = new Student("Elena", "Kylish", 987654321, new DateTime(1987, 8, 15)); Student thirdStudent = new Student("Oleg", "Ivanov", 975312468, new DateTime(1992, 11, 20)); MyDictionary students = new MyDictionary(); Tuple<string, string, int> key = new Tuple<string,string,int>("Alina", "Kylish", 123456789); students.Add(firstStudent); if (!students.Contains(key)) { Console.WriteLine("This key is not found"); } else { Console.WriteLine("This key is found"); } MyCollection students1 = new MyCollection(); students1.Add(firstStudent); students1.Add(secondStudent); students1.Insert(0, thirdStudent); students1.Add(firstStudent); students1.Remove(firstStudent); students1.Clear(); Console.ReadKey(); }
private void DoEmptyCollection() { MyCollection.Clear(); }