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)); }