public void CanSetPoliciesUsingTheContext()
        {
            BuilderContext     context = new BuilderContext(null, null, null);
            MockCreationPolicy policy  = new MockCreationPolicy();

            context.Policies.Set <IBuilderPolicy>(policy, typeof(object), "foo");

            Assert.AreSame(policy, context.Policies.Get <IBuilderPolicy>(typeof(object), "foo"));
        }
Ejemplo n.º 2
0
		public void CanSetPoliciesUsingTheContext()
		{
			BuilderContext context = new BuilderContext(null, null, null);
			MockCreationPolicy policy = new MockCreationPolicy();

			context.Policies.Set<IBuilderPolicy>(policy, typeof (object), "foo");

			Assert.AreSame(policy, context.Policies.Get<IBuilderPolicy>(typeof (object), "foo"));
		}
        public void TestSettingAndRetrievePolicy()
        {
            PolicyList         policies = new PolicyList();
            MockCreationPolicy policy   = new MockCreationPolicy();

            policies.Set <IBuilderPolicy>(policy, typeof(object), null);
            BuilderContext context = new BuilderContext(null, null, policies);

            IBuilderPolicy outPolicy = context.Policies.Get <IBuilderPolicy>(typeof(object), null);

            Assert.IsNotNull(outPolicy);
            Assert.AreSame(policy, outPolicy);
        }
Ejemplo n.º 4
0
		public void SettingPolicyViaContextDoesNotAffectPoliciesPassedToContextConstructor()
		{
			PolicyList policies = new PolicyList();
			MockCreationPolicy policy1 = new MockCreationPolicy();

			policies.Set<IBuilderPolicy>(policy1, typeof (object), null);
			BuilderContext context = new BuilderContext(null, null, policies);

			MockCreationPolicy policy2 = new MockCreationPolicy();
			context.Policies.Set<IBuilderPolicy>(policy2, typeof (string), null);

			Assert.AreEqual(1, policies.Count);
		}
Ejemplo n.º 5
0
		public void TestSettingAndRetrievePolicy()
		{
			PolicyList policies = new PolicyList();
			MockCreationPolicy policy = new MockCreationPolicy();

			policies.Set<IBuilderPolicy>(policy, typeof (object), null);
			BuilderContext context = new BuilderContext(null, null, policies);

			IBuilderPolicy outPolicy = context.Policies.Get<IBuilderPolicy>(typeof (object), null);

			Assert.IsNotNull(outPolicy);
			Assert.AreSame(policy, outPolicy);
		}
        public void SettingPolicyViaContextDoesNotAffectPoliciesPassedToContextConstructor()
        {
            PolicyList         policies = new PolicyList();
            MockCreationPolicy policy1  = new MockCreationPolicy();

            policies.Set <IBuilderPolicy>(policy1, typeof(object), null);
            BuilderContext context = new BuilderContext(null, null, policies);

            MockCreationPolicy policy2 = new MockCreationPolicy();

            context.Policies.Set <IBuilderPolicy>(policy2, typeof(string), null);

            Assert.AreEqual(1, policies.Count);
        }