Example #1
0
 public void APIKeyModelInitialized()
 {
     _checker = new APIKeysFileExistingChecker(Environment.CurrentDirectory);
     if (!_checker.IsAPIKeysFileExists)
     {
         _checker.CreateKeysConfingFile();
     }
     _apiKeyModel = new APIKeysRepository(_checker.ConfigFilePath);
 }
Example #2
0
        public void CheckCreatingKeyConfigFileIfExists()
        {
            string path = Environment.CurrentDirectory;
            APIKeysFileExistingChecker existingModel = new APIKeysFileExistingChecker(path);

            if (existingModel.IsAPIKeysFileExists)
            {
                Assert.AreEqual(path + "\\APIKeys.xml", existingModel.ConfigFilePath);
            }
        }
Example #3
0
        public void CheckCreatingKeyConfigFileIfNotExists()
        {
            string path = Environment.CurrentDirectory;
            APIKeysFileExistingChecker existingModel = new APIKeysFileExistingChecker(path);

            if (!existingModel.IsAPIKeysFileExists)
            {
                bool result = existingModel.CreateKeysConfingFile();
                Assert.AreEqual(path + "\\APIKeys.xml", existingModel.ConfigFilePath);
                File.Delete(path + "\\APIKeys.xml");
            }
        }
Example #4
0
        public ApiKeyController(IKeysView view)
        {
            APIKeysFileExistingChecker checker = new APIKeysFileExistingChecker(Environment.CurrentDirectory);

            if (!checker.IsAPIKeysFileExists)
            {
                checker.CreateKeysConfingFile();
            }
            _view = view;
            _view.SetInputHandler(this);

            _keysRepository = new APIKeysRepository(checker.ConfigFilePath);
            CurrentKey      = _keysRepository.FindCurrentAPIKey();

            _view.ShowCurrentKey(CurrentKey);
            _view.ShowAvailableKeys <APIKeyEntity>(_keysRepository.ReadAPIKeys());
        }
 public void Initialize()
 {
     _checker    = new APIKeysFileExistingChecker(Environment.CurrentDirectory);
     _view       = new EmptyView();
     _controller = new ApiKeyController(_view);
 }