public void When_resolving_Dispatcher_should_not_be_null() { var container = DefaultRegistry.Initialize(); var dispatcher = container.Get <IDispatcher>(); dispatcher.Should().NotBeNull(); }
public void Setup() { _currentVariable = Environment.GetEnvironmentVariable("DASENV"); Environment.SetEnvironmentVariable("DASENV", "LOCAL"); _registry = new DefaultRegistry(); }
private IContainer GetContainer(IConfigurationStore store) { var defaultRegistry = new DefaultRegistry(store); var container = new Container(c => { c.AddRegistry(defaultRegistry); }); return(container); }
private IContainer GetContainer(IConfiguration configuration = null) { var defaultRegistry = new DefaultRegistry(configuration); var container = new Container(c => { c.AddRegistry(defaultRegistry); }); return(container); }
public void VerifyRegistry() { Environment.SetEnvironmentVariable("DASENV", "LOCAL"); var registry = new DefaultRegistry(); var container = new Container(registry); container.AssertConfigurationIsValid(); }
public async Task <IActionResult> DefaultRegistry([FromRoute] long indicatorId, [FromBody] DefaultRegistry registry) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } // Don't add the registry if it has the same name as other registry on this indicator List <Registry> registries = await _context.Registries.Where(r => r.IndicatorID == indicatorId).ToListAsync(); foreach (Registry r in registries) { if (r.Name.ToUpper().Trim().Equals(registry.Name.ToUpper().Trim()) && r.RegistryID != indicatorId) { return(NoContent()); } } Indicator indicator = await _context.Indicators.SingleAsync(i => i.IndicatorID == indicatorId); indicator.Registries.Add(registry); _context.Entry(indicator).State = EntityState.Modified; try { await _context.SaveChangesAsync(); var createdRegistry = await _context.Registries.SingleOrDefaultAsync(m => m.RegistryID == registry.RegistryID); return(Ok(createdRegistry)); } catch (DbUpdateConcurrencyException) { if (!IndicatorExists(indicatorId)) { return(NotFound()); } else { throw; } } }
public async Task <IActionResult> PutRegistry([FromRoute] long indicator, [FromRoute] long id, [FromBody] DefaultRegistry registry) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } var registries = await _context.Registries.Where(r => r.IndicatorID == indicator && r.Name == registry.Name && r.RegistryID != id).ToListAsync(); if (registries.Any()) { return(NoContent()); } if (id != registry.RegistryID) { return(BadRequest()); } _context.Entry(registry).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!RegistryExists(id)) { return(NotFound()); } else { throw; } } return(Ok(registry)); }
protected override IKernel CreateContainer() { return(DefaultRegistry.Initialize()); }
public static void ContainerReset() { DefaultServiceLocator.Container.Reset(); DefaultRegistry registry = new DefaultRegistry(); registry.Register(DefaultServiceLocator.Container); }