public void UpdateOrAddLabelVMs_NewLabel_NewLabelCreatedAndOldLabelStaysAsIs() { var labels = new TorrentLabelCollection() { { "My Label", 1 }, }; GroupsViewModel.UpdateOrAddLabelVMs(labels, _labelsGroupVM, _groupItemFactory); Assert.AreEqual(2, _labelsGroupVM.Childs.Count); var noLabelVM = _labelsGroupVM.Childs.FirstOrDefault(x => x.Type == GroupType.NoLabel); Assert.IsNotNull(noLabelVM); var customLabelVM = _labelsGroupVM.Childs.FirstOrDefault(x => x.Type == GroupType.Label); Assert.AreEqual(labels.First().Text, customLabelVM.Text); Assert.AreEqual(labels.First().Count, customLabelVM.Count); }
public void UpdateOrAddLabelVMs_ModifiedLabelCount_LabelCountValueIncremented() { var labels = new TorrentLabelCollection() { { "My Label", 1 }, }; GroupsViewModel.UpdateOrAddLabelVMs(labels, _labelsGroupVM, _groupItemFactory); labels.First().Count++; GroupsViewModel.UpdateOrAddLabelVMs(labels, _labelsGroupVM, _groupItemFactory); Assert.AreEqual(2, _labelsGroupVM.Childs.Count); var noLabelVM = _labelsGroupVM.Childs.FirstOrDefault(x => x.Type == GroupType.NoLabel); Assert.IsNotNull(noLabelVM); var customLabelVM = _labelsGroupVM.Childs.FirstOrDefault(x => x.Type == GroupType.Label); Assert.AreEqual(labels.First().Text, customLabelVM.Text); Assert.AreEqual(labels.First().Count, customLabelVM.Count); }