public async Task <IEnumerable <ConfigurationItemDto> > GetConfiguration(ulong serverId = 0) { var query = new GetConfigurationQuery(serverId); var responseResult = await this._queryBus.ExecuteAsync(query); return(responseResult.ConfigurationItems.Select(x => new ConfigurationItemDto(x))); }
public async Task GetEnvironmentConfigurationsQueryHandler_Handle_ShouldReturnListOfEnvironmentConfigurations() { var configurationId = Guid.Parse("A35B42D0-2953-4DDC-963F-4EEFA40BB6F1"); var query = new GetConfigurationQuery(configurationId); var configurations = await TestData.Read <IEnumerable <Entity.Configuration> >("Configuration"); Context.Configurations.AddRange(configurations); await Context.SaveChangesAsync(CancellationToken.None); var configurationListView = await _configurationQueryHandler.Handle(query, CancellationToken.None); Assert.Equal(configurationId, configurationListView.Configuration.Id); }
public async Task<ActionResult> Index() { if (_configuration.GeneralConfigured()) { return RedirectToAction("Index", "Home"); } var query = new GetConfigurationQuery(); var result = await _messageDispatcher.Execute(query); if (!result.Succeeded) { return BadRequest(); } var response = MapResponse(result); return View(response); }
public async Task <ActionResult> Index() { if (_configuration.GeneralConfigured()) { return(RedirectToAction("Index", "Home")); } var query = new GetConfigurationQuery(); var result = await _messageDispatcher.Execute(query); if (!result.Succeeded) { return(BadRequest()); } var response = MapResponse(result); return(View(response)); }
public async Task GetConfigurationQueryHandler_Handle_ShouldThrowExceptionIfConfigurationIdIsNotSet() { var query = new GetConfigurationQuery(Guid.Empty); await Assert.ThrowsAsync <InvalidInputException>(() => _configurationQueryHandler.Handle(query, CancellationToken.None)); }