public void WhenResponseHasLessElementsThanMax_ThenIndicatesNoErrorOnResponse() { var template = new MultipleSelectionQuestionTemplate() { Range = new[] { "one", "two", "three" }, MaxSelections = 2 }; var question = template.CreateNewQuestion() as MultipleSelectionQuestion; var notifyErrorInfo = (INotifyDataErrorInfo)question; question.Response = new[] { "one" }; Assert.IsFalse(notifyErrorInfo.GetErrors("Response").Cast <ValidationResult>().Any()); }
public void WhenSettingASelectionOnTheViewModel_ThenHasChangesIsTrue() { var template = new MultipleSelectionQuestionTemplate { Range = new[] { "a", "b", "c" }, MaxSelections = 2 }; var question = template.CreateNewQuestion() as MultipleSelectionQuestion; var viewModel = new MultipleSelectionQuestionViewModel(question); int responseChanges = 0; viewModel.ResponseChanged += (s, e) => responseChanges++; viewModel.Selections.Add("a"); Assert.IsTrue(viewModel.HasChanges); }