public LeadersPageViewModel(List <ImageObject> list) { People = new ObservableCollection <ImageObject>(); list = ViewModelsUtil.SortList(list); foreach (var person in list) { People.Add(person); } }
public void SortList_ShouldReturnSorted() { //Arrange var firstObject = new ImageObject() { Id = 1, ImageContentUri = "test", ImageName = "test", PersonFirstName = "test", PersonLastName = "test", DescriptiveSentence = "test", Score = 1 }; var secondObject = new ImageObject() { Id = 1, ImageContentUri = "test", ImageName = "test", PersonFirstName = "test", PersonLastName = "test", DescriptiveSentence = "test", Score = 2 }; var imagesList = new List <ImageObject>() { firstObject, secondObject }; var expectedImagesList = new List <ImageObject>() { secondObject, firstObject }; //Act var result = ViewModelsUtil.SortList(imagesList); //Assert CollectionAssert.IsOrdered(result); Assert.IsTrue(expectedImagesList.SequenceEqual(result)); }