public void DoNotReloadDictionaryWhenLanguageIsTheSame(){ //Arrange var mockDictionaryService = new Mock<IDictionaryService>(); var wordsViewModel = new WordsViewModel(mockDictionaryService.Object); //Act wordsViewModel.KeyboardAndDictionaryLanguage = wordsViewModel.KeyboardAndDictionaryLanguage; wordsViewModel.ApplyChanges(); //Assert mockDictionaryService.Verify(t => t.LoadDictionary(), Times.Exactly(0)); }
public void ReloadDictionaryWhenLanguageChanged(){ //Arrange var mockDictionaryService = new Mock<IDictionaryService>(); var wordsViewModel = new WordsViewModel(mockDictionaryService.Object); //Act wordsViewModel.KeyboardAndDictionaryLanguage = wordsViewModel.KeyboardAndDictionaryLanguage == Enums.Languages.FrenchFrance ? Enums.Languages.EnglishUK : Enums.Languages.FrenchFrance; wordsViewModel.ApplyChanges(); //Assert mockDictionaryService.Verify(t => t.LoadDictionary(), Times.AtLeast(1)); }
public ManagementViewModel( IAudioService audioService, IDictionaryService dictionaryService) { //Instantiate child VMs DictionaryViewModel = new DictionaryViewModel(dictionaryService); OtherViewModel = new OtherViewModel(); PointingAndSelectingViewModel = new PointingAndSelectingViewModel(); SoundsViewModel = new SoundsViewModel(audioService); VisualsViewModel = new VisualsViewModel(); WordsViewModel = new WordsViewModel(dictionaryService); //Instantiate interaction requests and commands ConfirmationRequest = new InteractionRequest<Confirmation>(); OkCommand = new DelegateCommand<Window>(Ok); //Can always click Ok CancelCommand = new DelegateCommand<Window>(Cancel); //Can always click Cancel }