public void AnswerInitializedFromPrevious() { string previousAnswer = "test_answer"; ScheduleItem item = TextPromptItem.Build(); mockRepo.Setup(r => r.GetAnswer(item.ItemId)) .Returns(previousAnswer); ScheduleItemViewModel model = new ScheduleItemViewModel(item, mockRepo.Object); Assert.Equal(previousAnswer, model.Answer); }
public void AnswerSavedOnNext() { string modifiedItemId = "1234"; string answerText = "test answer"; Schedule schedule = new ScheduleBuilder() .WithItems( TextPromptItem.WithId(modifiedItemId).Build(), TextPromptItem.Build()) .Build(); SchedulePageViewModel model = new SchedulePageViewModel(schedule, mockRecordingManager.Object, new DummyEventTracker(), new DummyDictionary(), mockRepo.Object, mockConfiguration.Object); // simulate text answer entered model.ItemViewModel.Answer = answerText; model.ItemViewModel.AnswerModified = true; model.NextCommand.Execute(null); mockRecordingManager.Verify(f => f.FinalizeAnswer(modifiedItemId, answerText)); }