public void CanConfigureInAppContext() { TypeRegistry.RegisterType("TransactionPropagation", typeof(TransactionPropagation)); IApplicationContext ctx = new XmlApplicationContext( "assembly://Spring.Data.Tests/Spring.Transaction.Interceptor/MatchAlwaysTransactionAttributeSourceTests.xml"); MatchAlwaysTransactionAttributeSource tas = (MatchAlwaysTransactionAttributeSource)ctx.GetObject("MatchAlwaysTransactionAttributeSource"); Assert.AreEqual(TransactionPropagation.RequiresNew, tas.ReturnTransactionAttribute(null, null).PropagationBehavior); }
public void GetTransactionAttribute() { MatchAlwaysTransactionAttributeSource tas = new MatchAlwaysTransactionAttributeSource(); ITransactionAttribute ta = tas.ReturnTransactionAttribute(typeof (Object).GetMethod("GetHashCode"), null); Assert.IsNotNull(ta); Assert.IsTrue(TransactionPropagation.Required == ta.PropagationBehavior); tas.TransactionAttribute = new DefaultTransactionAttribute(TransactionPropagation.Supports); ta = tas.ReturnTransactionAttribute(typeof (DataException).GetType().GetMethod("GetHashCode"), typeof (DataException)); Assert.IsNotNull(ta); Assert.IsTrue(TransactionPropagation.Supports == ta.PropagationBehavior); }
/// <summary> /// Determines whether the specified <see cref="T:System.Object"></see> is equal to the current <see cref="T:System.Object"></see>. /// </summary> /// <param name="obj">The <see cref="T:System.Object"></see> to compare with the current <see cref="T:System.Object"></see>.</param> /// <returns> /// true if the specified <see cref="T:System.Object"></see> is equal to the current <see cref="T:System.Object"></see>; otherwise, false. /// </returns> public override bool Equals(object obj) { if (this == obj) { return(true); } MatchAlwaysTransactionAttributeSource matchAlwaysTransactionAttributeSource = obj as MatchAlwaysTransactionAttributeSource; if (matchAlwaysTransactionAttributeSource == null) { return(false); } return(Equals(_transactionAttribute, matchAlwaysTransactionAttributeSource._transactionAttribute)); }
public void GetTransactionAttribute() { MatchAlwaysTransactionAttributeSource tas = new MatchAlwaysTransactionAttributeSource(); ITransactionAttribute ta = tas.ReturnTransactionAttribute(typeof(Object).GetMethod("GetHashCode"), null); Assert.IsNotNull(ta); Assert.IsTrue(TransactionPropagation.Required == ta.PropagationBehavior); tas.TransactionAttribute = new DefaultTransactionAttribute(TransactionPropagation.Supports); ta = tas.ReturnTransactionAttribute(typeof(DataException).GetType().GetMethod("GetHashCode"), typeof(DataException)); Assert.IsNotNull(ta); Assert.IsTrue(TransactionPropagation.Supports == ta.PropagationBehavior); }