public void ShouldCompareCorrectly() { var aList = new NamedCustomLinkedList <Student>("A"); var bList = new NamedCustomLinkedList <Student>("B"); Assert.AreEqual(-1, aList.CompareTo(bList)); Assert.AreEqual(1, bList.CompareTo(aList)); Assert.AreEqual(0, aList.CompareTo(aList)); Assert.AreEqual(0, bList.CompareTo(bList)); }
private void ChooseGroup(object sender, RoutedEventArgs e) { var gs = new GroupSelect(uni); gs.Resources["fontColor"] = Resources["fontColor"]; gs.Resources["fontFamily"] = Resources["fontFamily"]; gs.Resources["fontBold"] = Resources["fontBold"]; gs.Resources["fontSize"] = Resources["fontSize"]; gs.ShowDialog(); currentList = gs.SelectedGroup ?? currentList; Refresh(); }
public void ShouldCompareWithNull() { var aList = new NamedCustomLinkedList <Student>("A"); Assert.True(aList < null); Assert.True(null > aList); Assert.True(aList <= null); Assert.True(null >= aList); Assert.False(null < aList); Assert.False(aList > null); Assert.False(null <= aList); Assert.False(aList >= null); }
public void ShouldCompareByName() { var aList = new NamedCustomLinkedList <Student>("A"); var bList = new NamedCustomLinkedList <Student>("B"); Assert.True(aList > bList); Assert.True(bList < aList); Assert.True(aList >= bList); Assert.True(bList <= aList); Assert.False(aList < bList); Assert.False(bList > aList); Assert.False(aList <= bList); Assert.False(bList >= aList); }
public MainWindow() { uni = new List <NamedCustomLinkedList <NamedCustomLinkedList <Student> > >(); var defaultFaculty = new NamedCustomLinkedList <NamedCustomLinkedList <Student> >("Default faculty"); var defaultGroup = new NamedCustomLinkedList <Student>("Default List"); defaultFaculty.PushToEnd(defaultGroup); uni.Add(defaultFaculty); currentList = defaultGroup; InitializeComponent(); DataContext = this; Refresh(); }
private void RefreshGroups() { observableGroupList.Clear(); if (!(selectedFaculty is null)) { selectedFaculty.Sort(); foreach (var group in selectedFaculty) { observableGroupList.Add(group); } if (observableGroupList.Count != 0) { selectedGroup = selectedFaculty.Get(0); } } }
private void Refresh() { observableFacultyList.Clear(); observableGroupList.Clear(); selectedFaculty = null; selectedGroup = null; uni.Sort(); foreach (var faculty in uni) { observableFacultyList.Add(faculty); } if (observableFacultyList.Count != 0) { selectedFaculty = uni[0]; RefreshGroups(); } UpdateCanDeleteStatuses(); }
public void CloningShouldWork() { // given var namedList = new NamedCustomLinkedList <Student>("Name"); var student1 = new Student("F1", "L", "N", 1999); var student2 = new Student("F2", "L", "N", 1999); var student3 = new Student("F3", "L", "N", 1999); namedList.AddAll(student1, student2, student3); namedList.MoveToTail(); // when var clone = (NamedCustomLinkedList <Student>)namedList.Clone(); // then Assert.AreEqual("Name", clone.Name); Assert.AreEqual(3, clone.Size); Assert.AreEqual("F3", clone.Current.FirstName); Assert.False(ReferenceEquals(student3, clone.Current)); }
public void NamedCustomLinkedListShouldHaveName() { var namedList = new NamedCustomLinkedList <Student>("Custom Name"); Assert.AreEqual("Custom Name", namedList.Name); }