public void CanGetInstalledVoice_WithoutSelecting() { _speechSynth.Expect(s => s.SelectedVoice).Return(new CradiatorInstalledVoice("Bob")); _speechSynth.Expect(s => s.GetInstalledVoices()) .Return(new List <CradiatorInstalledVoice> { new CradiatorInstalledVoice("Bob"), }); Assert.That(_voiceSelector.GetClosestMatchingInstalledVoice("DodgyVoiceName"), Is.EqualTo(new CradiatorInstalledVoice("Bob"))); _speechSynth.AssertWasNotCalled(s => s.SelectVoice(Arg <string> .Is.Anything)); }
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { return(_voiceSelector.GetClosestMatchingInstalledVoice(value as string)); }