public void NameMatchTransactionAttributeSource()
 {
     NameMatchTransactionAttributeSource tas = new NameMatchTransactionAttributeSource();
     IDictionary methodMap = new Hashtable();                     
     methodMap.Add("GetHashCode", "PROPAGATION_REQUIRED");
     methodMap.Add("ToString", new DefaultTransactionAttribute(TransactionPropagation.Supports));
     tas.NameMap = methodMap;            
     ITransactionAttribute ta = tas.ReturnTransactionAttribute(typeof (object).GetMethod("GetHashCode"), null);
     Assert.IsNotNull(ta);
     Assert.AreEqual(TransactionPropagation.Required, ta.PropagationBehavior);
     ta = tas.ReturnTransactionAttribute(typeof (object).GetMethod("ToString"), null);
     Assert.IsNotNull(ta);
     Assert.AreEqual(TransactionPropagation.Supports, ta.PropagationBehavior);
 }
        public void NameMatchTransactionAttributeSource()
        {
            NameMatchTransactionAttributeSource tas = new NameMatchTransactionAttributeSource();
            IDictionary methodMap = new Hashtable();

            methodMap.Add("GetHashCode", "PROPAGATION_REQUIRED");
            methodMap.Add("ToString", new DefaultTransactionAttribute(TransactionPropagation.Supports));
            tas.NameMap = methodMap;
            ITransactionAttribute ta = tas.ReturnTransactionAttribute(typeof(object).GetMethod("GetHashCode"), null);

            Assert.IsNotNull(ta);
            Assert.AreEqual(TransactionPropagation.Required, ta.PropagationBehavior);
            ta = tas.ReturnTransactionAttribute(typeof(object).GetMethod("ToString"), null);
            Assert.IsNotNull(ta);
            Assert.AreEqual(TransactionPropagation.Supports, ta.PropagationBehavior);
        }
 public void NameMatchTransactionAttributeSourceWithStarAtStartOfMethodName()
 {
     NameMatchTransactionAttributeSource tas = new NameMatchTransactionAttributeSource();
     NameValueCollection attributes = new NameValueCollection();
     attributes.Add("*ashCode", "PROPAGATION_REQUIRED");
     tas.NameProperties = attributes;
     ITransactionAttribute ta = tas.ReturnTransactionAttribute(typeof (object).GetMethod("GetHashCode"), null);
     Assert.IsNotNull(ta);
     Assert.AreEqual(TransactionPropagation.Required, ta.PropagationBehavior);
 }
        public void NameMatchTransactionAttributeSourceWithEmptyMethodName()
        {
            NameMatchTransactionAttributeSource tas = new NameMatchTransactionAttributeSource();
            NameValueCollection attributes          = new NameValueCollection();

            attributes.Add("", "PROPAGATION_MANDATORY");
            tas.NameProperties = attributes;
            ITransactionAttribute ta = tas.ReturnTransactionAttribute(typeof(object).GetMethod("GetHashCode"), null);

            Assert.IsNull(ta);
        }
        public void NameMatchTransactionAttributeSourceWithStarAtEndOfMethodName()
        {
            NameMatchTransactionAttributeSource tas = new NameMatchTransactionAttributeSource();
            NameValueCollection attributes          = new NameValueCollection();

            attributes.Add("GetHashCod*", "PROPAGATION_REQUIRED");
            tas.NameProperties = attributes;
            ITransactionAttribute ta = tas.ReturnTransactionAttribute(typeof(object).GetMethod("GetHashCode"), null);

            Assert.IsNotNull(ta);
            Assert.AreEqual(TransactionPropagation.Required, ta.PropagationBehavior);
        }
        public void NameMatchTransactionAttributeSourceMostSpecificMethodNameIsDefinitelyMatched()
        {
            NameMatchTransactionAttributeSource tas = new NameMatchTransactionAttributeSource();
            NameValueCollection attributes          = new NameValueCollection();

            attributes.Add("*", "PROPAGATION_REQUIRED");
            attributes.Add("GetHashCode", "PROPAGATION_MANDATORY");
            tas.NameProperties = attributes;
            ITransactionAttribute ta = tas.ReturnTransactionAttribute(typeof(object).GetMethod("GetHashCode"), null);

            Assert.IsNotNull(ta);
            Assert.AreEqual(TransactionPropagation.Mandatory, ta.PropagationBehavior);
        }
 public void NameMatchTransactionAttributeSourceWithEmptyMethodName()
 {
     NameMatchTransactionAttributeSource tas = new NameMatchTransactionAttributeSource();
     NameValueCollection attributes = new NameValueCollection();
     attributes.Add("", "PROPAGATION_MANDATORY");
     tas.NameProperties = attributes;
     ITransactionAttribute ta = tas.ReturnTransactionAttribute(typeof(object).GetMethod("GetHashCode"), null);
     Assert.IsNull(ta);            
 }
 public void NameMatchTransactionAttributeSourceMostSpecificMethodNameIsDefinitelyMatched()
 {
     NameMatchTransactionAttributeSource tas = new NameMatchTransactionAttributeSource();
     NameValueCollection attributes = new NameValueCollection();
     attributes.Add("*", "PROPAGATION_REQUIRED");
     attributes.Add("GetHashCode", "PROPAGATION_MANDATORY");
     tas.NameProperties = attributes;
     ITransactionAttribute ta = tas.ReturnTransactionAttribute(typeof(object).GetMethod("GetHashCode"), null);
     Assert.IsNotNull(ta);
     Assert.AreEqual(TransactionPropagation.Mandatory, ta.PropagationBehavior);
 }