protected override void Context()
        {
            _view          = A.Fake <IApplicationSettingsView>();
            _dialogCreator = A.Fake <IDialogCreator>();

            _applicationSettings = new ApplicationSettings();
            _speciesRepository   = A.Fake <ISpeciesRepository>();
            A.CallTo(() => _speciesRepository.All()).Returns(new[]
            {
                new Species {
                    Name = "Dog", Id = "Dog"
                },
                new Species {
                    Name = "Human", Id = "Human"
                },
                new Species {
                    Name = "Rat", Id = "Rat"
                }
            });
            _speciesDatabaseDTOMapper     = new SpeciesDatabaseMapToSpeciesDatabaseMapDTOMapper(_speciesRepository, new RepresentationInfoRepositoryForSpecs());
            _applicationSettingsPersistor = A.Fake <IApplicationSettingsPersistor>();

            sut = new ApplicationSettingsPresenter(_view, _applicationSettings, _speciesRepository, _speciesDatabaseDTOMapper, _dialogCreator, _applicationSettingsPersistor);

            A.CallTo(() => _view.BindTo(A <ApplicationSettingsDTO> ._))
            .Invokes(x => _dto = x.GetArgument <ApplicationSettingsDTO>(0));
        }
コード例 #2
0
 public ApplicationSettingsPresenter(IApplicationSettingsView view, IApplicationSettings applicationSettings, IDialogCreator dialogCreator) : base(view)
 {
     _applicationSettings    = applicationSettings;
     _dialogCreator          = dialogCreator;
     _applicationSettingsDTO = new ApplicationSettingsDTO(_applicationSettings);
     _view.BindTo(_applicationSettingsDTO);
 }
コード例 #3
0
        public void SaveSettings(ApplicationSettingsDTO applicationSettingsDTO)
        {
            var fileReadingLibrarySettings = new FileReadingLibrarySettings()
            {
                LoggedUserId = applicationSettingsDTO.UserId
            };

            this.fileReadingLibrarySettingsRepository.Update(fileReadingLibrarySettings);
        }
コード例 #4
0
 public ApplicationSettingsPresenter(IApplicationSettingsView view, IApplicationSettings applicationSettings,
                                     ISpeciesRepository speciesRepository, ISpeciesDatabaseMapToSpeciesDatabaseMapDTOMapper speciesMapper,
                                     IDialogCreator dialogCreator, IApplicationSettingsPersistor applicationSettingsPersistor) : base(view)
 {
     _applicationSettings          = applicationSettings;
     _speciesRepository            = speciesRepository;
     _speciesMapper                = speciesMapper;
     _dialogCreator                = dialogCreator;
     _applicationSettingsPersistor = applicationSettingsPersistor;
     _applicationSettingsDTO       = mapFrom(applicationSettings);
 }
コード例 #5
0
        public void Setup()
        {
            // mock the settings here
            var applicationOptions = new ApplicationSettingsDTO()
            {
                JWT_Secret = "1234567890123456", Client_URL = "http://localhost:4200/"
            };

            _options = Options.Create(applicationOptions);
            var user = new ApplicationUser();
        }
コード例 #6
0
        public ActionResult Start(ApplicationSettingsDTO applicationSettingsDTO)
        {
            try
            {
                this.settingService.SaveSettings(applicationSettingsDTO);

                return(RedirectToAction("Index", "File"));
            }
            catch
            {
                return(View());
            }
        }
コード例 #7
0
        // GET: Setting/Index
        public ActionResult Start()
        {
            var applicationSettingsDTO = new ApplicationSettingsDTO();

            ViewBag.Users = this.settingService.GetUsers()
                            .Select(x => new SelectListItem()
            {
                Text  = x.Username,
                Value = x.Id.ToString()
            });

            return(View(applicationSettingsDTO));
        }
コード例 #8
0
 public void BindTo(ApplicationSettingsDTO applicationSettings)
 {
     _screenBinder.BindToSource(applicationSettings);
 }
コード例 #9
0
 public RegistrationService(UserManager <ApplicationUser> userManager, IOptions <ApplicationSettingsDTO> appSettings)
 {
     _userManager = userManager;
     _appSettings = appSettings.Value;
 }