public MenuVM(
            IOpenFileDialog openFileDialog,
            IDictionaryImporter dictionaryImporter,
            IRepository dictionaryRepository)
        {
            _openFileDialog        = openFileDialog;
            _dictionaryImporter    = dictionaryImporter;
            _dictionaryRepository  = dictionaryRepository;
            _openFileDialog.Filter = "Comma separated files (*.csv)|*.csv|All files (*.*)|*.*";

            AvailableDictionaries = new ObservableCollection <Dictionary>();
        }
        public MenuVM(
            IOpenFileDialog openFileDialog,
            IDictionaryImporter dictionaryImporter,
            IRepository dictionaryRepository)
        {
            _openFileDialog = openFileDialog;
            _dictionaryImporter = dictionaryImporter;
            _repository = dictionaryRepository;
            _openFileDialog.Filter = "Comma separated files (*.csv)|*.csv|All files (*.*)|*.*";

            AvailableDictionaries = new ObservableCollection<Dictionary>();
        }
        public void Initialize()
        {
            _textFileReaderMock = new Mock<ITextFileReader>();

            _wordlistParserMock = new Mock<IWordlistParser>();
            _wordlistParserMock.Setup(p => p.Import(It.IsAny<IEnumerable<string>>()))
                               .Returns(new List<DictionaryEntry>
                                   {
                                       new DictionaryEntry("你", "ni3", new List<Translation> {new Translation("you")})
                                   });

            _dictionaryRepositoryMock = new Mock<IRepository>();

            _objectUnderTest = new DictionaryImporter(
                _textFileReaderMock.Object, _wordlistParserMock.Object, _dictionaryRepositoryMock.Object);
        }
示例#4
0
        public void Initialize()
        {
            _textFileReaderMock = new Mock <ITextFileReader>();

            _wordlistParserMock = new Mock <IWordlistParser>();
            _wordlistParserMock.Setup(p => p.Import(It.IsAny <IEnumerable <string> >()))
            .Returns(new List <DictionaryEntry>
            {
                new DictionaryEntry("你", "ni3", new List <Translation> {
                    new Translation("you")
                })
            });

            _dictionaryRepositoryMock = new Mock <IRepository>();

            _objectUnderTest = new DictionaryImporter(
                _textFileReaderMock.Object, _wordlistParserMock.Object, _dictionaryRepositoryMock.Object);
        }