Exemplo n.º 1
0
 public void try_to_add_without_provenance_throws_exception()
 {
     Exception <ArgumentException> .ShouldBeThrownBy(() => {
         var actions = new ConfigurationActionSet("something");
         actions.Fill(new Provenance[0], new UniquePolicy());
     });
 }
Exemplo n.º 2
0
        public void ApplyPolicies(ConfigurationActionSet actions)
        {
            var graph = new BehaviorGraph();

            _chains.Values.Each(graph.AddChain);

            actions.RunActions(graph);
        }
Exemplo n.º 3
0
        public void adds_with_the_entire_provenance_stack()
        {
            var actions = new ConfigurationActionSet("something");

            actions.Fill(provenanceStack, new UniquePolicy());

            var log = actions.Logs.Single();

            log.ProvenanceChain.Chain.ShouldHaveTheSameElementsAs(provenanceStack);
        }
        public void latches_duplicate_types_if_they_are_unique()
        {
            var policy1 = new UniquePolicy();
            var policy2 = new UniquePolicy();

            var actions = new ConfigurationActionSet("something");
            actions.Fill(policy1);

            // policy2 should be treated as a duplicate of policy1
            actions.Fill(policy2);

            actions.Actions.Single().ShouldBeTheSameAs(policy1);
        }
Exemplo n.º 5
0
        public void latches_duplicate_types_if_they_are_unique()
        {
            var policy1 = new UniquePolicy();
            var policy2 = new UniquePolicy();

            var actions = new ConfigurationActionSet();

            actions.Fill(policy1);

            // policy2 should be treated as a duplicate of policy1
            actions.Fill(policy2);

            actions.Actions.Single().ShouldBeTheSameAs(policy1);
        }
        public void can_register_actions_of_the_same_type_that_are_determined_to_not_be_equivalent()
        {
            var policy1 = new ConfiguredPolicy("foo");
            var policy2 = new ConfiguredPolicy("bar");

            policy1.ShouldNotEqual(policy2);

            var actions = new ConfigurationActionSet("something");
            actions.Fill(policy1);

            // policy2 should be treated as a duplicate of policy1
            actions.Fill(policy2);

            actions.Actions.ShouldHaveTheSameElementsAs(policy1, policy2);
        }
Exemplo n.º 7
0
        public void can_register_actions_of_the_same_type_that_are_determined_to_not_be_equivalent()
        {
            var policy1 = new ConfiguredPolicy("foo");
            var policy2 = new ConfiguredPolicy("bar");

            policy1.ShouldNotBe(policy2);

            var actions = new ConfigurationActionSet();

            actions.Fill(policy1);

            // policy2 should be treated as a duplicate of policy1
            actions.Fill(policy2);

            actions.Actions.ShouldHaveTheSameElementsAs(policy1, policy2);
        }
Exemplo n.º 8
0
        public void will_not_double_register_actions_that_are_determined_to_be_equivalent()
        {
            var policy1 = new ConfiguredPolicy("foo");
            var policy2 = new ConfiguredPolicy("foo");

            policy1.ShouldBe(policy2);

            var actions = new ConfigurationActionSet();

            actions.Fill(policy1);

            // policy2 should be treated as a duplicate of policy1
            actions.Fill(policy2);

            actions.Actions.Single().ShouldBeTheSameAs(policy1);
        }
Exemplo n.º 9
0
 public void type_is_unique_if_there_is_no_attribute_no_non_default_ctor_and_no_settable_properties()
 {
     ConfigurationActionSet.TypeIsUnique(typeof(UniquePolicy))
     .ShouldBeTrue();
 }
Exemplo n.º 10
0
 public void type_is_not_unique_if_there_are_any_settable_properties()
 {
     ConfigurationActionSet.TypeIsUnique(typeof(PropertiesPolicy))
     .ShouldBeFalse();
 }
Exemplo n.º 11
0
 public void type_is_not_unique_if_there_are_any_constructors_with_parameters()
 {
     ConfigurationActionSet.TypeIsUnique(typeof(ConfiguredPolicy))
     .ShouldBeFalse();
 }
Exemplo n.º 12
0
 public void type_is_unique_is_false_if_the_CanBeMultiplesAttribute_exists()
 {
     ConfigurationActionSet.TypeIsUnique(typeof(SimpleMultiplePolicy)).ShouldBeFalse();
 }
Exemplo n.º 13
0
        public void will_not_double_register_actions_that_are_determined_to_be_equivalent()
        {
            var policy1 = new ConfiguredPolicy("foo");
            var policy2 = new ConfiguredPolicy("foo");

            policy1.ShouldEqual(policy2);

            var actions = new ConfigurationActionSet("something");
            actions.Fill(policy1);

            // policy2 should be treated as a duplicate of policy1
            actions.Fill(policy2);

            actions.Actions.Single().ShouldBeTheSameAs(policy1);
        }
Exemplo n.º 14
0
 public void Import(ConfigurationActionSet others)
 {
     others._actions.Each(Fill);
 }