示例#1
0
        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));
        }
示例#2
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));
        }
示例#3
0
        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
        }