private void CreateNewViewModelsWhereNeeded(List <UiSkill> skillUpdateList) { for (int i = _currentCollection.Count; i < skillUpdateList.Count; i++) { _currentCollection.Add(_skillViewModelFactory.Create(skillUpdateList[i])); } }
public void Rebind_EmptyToBeginWith_CreatesNewViewModels() { //Arrange var currentData = new ObservableCollection <ISkillViewModel>(); var newUiSkill = new UiSkill { Id = Guid.NewGuid() }; var newData = new List <UiSkill> { newUiSkill }; var fakeSkillViewModel = A.Fake <ISkillViewModel>(); A.CallTo(() => _skillViewModelFactory.Create(newUiSkill)).Returns(fakeSkillViewModel); //Act _skillTableViewModelBindingHelper.Rebind(currentData, newData); //Assert currentData.FirstOrDefault().Should().Be(fakeSkillViewModel); }