private void addStringConversions(DisplayConversionRegistry conversions) { var registry = new ServiceRegistry(); registry.AddService(typeof(DisplayConversionRegistry), ObjectDef.ForValue(conversions)); _graph.Add(registry); }
/// <summary> /// Apply a new behavior re-ordering rule in order to force behaviors to a certain order. /// For example, force Authentication behaviors to always be before Authorization behaviors /// </summary> /// <param name="configure"></param> /// <returns></returns> public PoliciesExpression Reorder(Action <ReorderBehaviorsPolicy> configure) { var policy = new ReorderBehaviorsPolicy(); configure(policy); _configuration.Add(policy, ConfigurationType.Reordering); return(this); }
public void prepend_provenance() { var graph = new ConfigGraph(); var defaultConfigurationPack = new DefaultConfigurationPack(); graph.Add(defaultConfigurationPack); var p1 = MockRepository.GenerateMock <Provenance>(); var p2 = MockRepository.GenerateMock <Provenance>(); graph.PrependProvenance(new Provenance[] { p1, p2 }); graph.LogsFor(ConfigurationType.Conneg).Each(log => { log.ProvenanceChain.ShouldHaveTheSameElementsAs(p1, p2, new ConfigurationPackProvenance(defaultConfigurationPack)); }); graph.LogsFor(ConfigurationType.ModifyRoutes).Each(log => { log.ProvenanceChain.ShouldHaveTheSameElementsAs(p1, p2, new ConfigurationPackProvenance(defaultConfigurationPack)); }); graph.LogsFor(ConfigurationType.InjectNodes).Each(log => { log.ProvenanceChain.ShouldHaveTheSameElementsAs(p1, p2, new ConfigurationPackProvenance(defaultConfigurationPack)); }); graph.LogsFor(ConfigurationType.Attachment).Each(log => { log.ProvenanceChain.ShouldHaveTheSameElementsAs(p1, p2, new ConfigurationPackProvenance(defaultConfigurationPack)); }); }
public void add_configuration_action_with_default_configuration_type() { var graph = new ConfigGraph(Assembly.GetExecutingAssembly()); var action = new IndeterminateAction(); graph.Add(action, ConfigurationType.Explicit); graph.ActionsFor(ConfigurationType.Explicit).Single() .ShouldBeTheSameAs(action); }
public void add_configuration_action_that_is_marked_with_attribute() { var graph = new ConfigGraph(Assembly.GetExecutingAssembly()); var action = new DeterminateAciton(); graph.Add(action); graph.ActionsFor(ConfigurationType.Explicit).Single() .ShouldBeTheSameAs(action); }
public void add_configuration_action_with_default_configuration_type() { var graph = new ConfigGraph(); var action = new IndeterminateAction(); graph.Push(new SomeFubuRegistry()); graph.Add(action, ConfigurationType.Explicit); graph.ActionsFor(ConfigurationType.Explicit).Single() .ShouldBeTheSameAs(action); }
public void add_configuration_action_that_is_marked_with_attribute() { var graph = new ConfigGraph(); graph.Push(new SomeFubuRegistry()); var action = new DeterminateAciton(); graph.Add(action); graph.ActionsFor(ConfigurationType.Conneg).Single() .ShouldBeTheSameAs(action); }
public void add_configuration_pak() { var pack = new DiscoveryActionsConfigurationPack(); var graph = new ConfigGraph(); graph.Add(pack); graph.LogsFor(ConfigurationType.Discovery).Each(log => { log.ProvenanceChain.ShouldHaveTheSameElementsAs(new ConfigurationPackProvenance(pack)); }); graph.LogsFor(ConfigurationType.Discovery).Any().ShouldBeTrue(); }
public void fill_action_puts_the_provenance_in_the_right_order() { var bottle = new AssemblyPackageInfo(Assembly.GetExecutingAssembly()); var graph = new ConfigGraph(); graph.Push(bottle); var extension = new FakeRegistryExtension(); graph.Push(extension); var policy = new UniquePolicy(); graph.Add(policy, ConfigurationType.Policy); graph.LogsFor(ConfigurationType.Policy).Single() .ProvenanceChain.ShouldHaveTheSameElementsAs(new BottleProvenance(bottle), new FubuRegistryExtensionProvenance(extension)); }
public void add_configuration_pack_has_to_be_idempotent() { var pack = new DiscoveryActionsConfigurationPack(); var graph = new ConfigGraph(); graph.Add(pack); var count = graph.LogsFor(ConfigurationType.Discovery).Count(); graph.Add(new DiscoveryActionsConfigurationPack()); graph.Add(new DiscoveryActionsConfigurationPack()); graph.Add(new DiscoveryActionsConfigurationPack()); graph.Add(new DiscoveryActionsConfigurationPack()); graph.Add(new DiscoveryActionsConfigurationPack()); graph.LogsFor(ConfigurationType.Discovery).Count() .ShouldEqual(count); }
/// <summary> /// Find actions with the provided <see cref="IActionSource"/> instance. /// </summary> public ActionCallCandidateExpression FindWith(IActionSource actionSource) { _configuration.Add(actionSource); return(this); }
private void alter(Action <RouteDefinitionResolver> alteration) { _configuration.Add(new SettingAlteration <RouteDefinitionResolver>(alteration)); }
public void ChainSource <T>() where T : IChainSource, new() { _graph.Add(new T()); }