public void GetTransaction_gets_existing_transaction_if_active([Frozen] IGetsNHibernateTransaction wrapped,
                                                                ISession session,
                                                                PreferExistingNativeTransactionDecorator sut,
                                                                global::NHibernate.ITransaction expected)
 {
     Mock.Get(session).SetupGet(x => x.Transaction).Returns(expected);
     Mock.Get(expected).SetupGet(x => x.IsActive).Returns(true);
     Assert.That(() => sut.GetTransaction(session), Is.SameAs(expected));
 }
 public void GetTransaction_creates_transaction_from_wrapped_if_transaction_not_active([Frozen] IGetsNHibernateTransaction wrapped,
                                                                                       ISession session,
                                                                                       PreferExistingNativeTransactionDecorator sut,
                                                                                       global::NHibernate.ITransaction expected,
                                                                                       global::NHibernate.ITransaction other)
 {
     Mock.Get(session).SetupGet(x => x.Transaction).Returns(other);
     Mock.Get(other).SetupGet(x => x.IsActive).Returns(false);
     Mock.Get(wrapped).Setup(x => x.GetTransaction(session)).Returns(expected);
     Assert.That(() => sut.GetTransaction(session), Is.SameAs(expected));
 }
 /// <summary>
 /// Initializes a new instance of the
 /// <see cref="PreferExistingNativeTransactionDecorator"/> class.
 /// </summary>
 /// <param name="wrapped">Wrapped.</param>
 public PreferExistingNativeTransactionDecorator(IGetsNHibernateTransaction wrapped)
 {
     this.wrapped = wrapped ?? throw new ArgumentNullException(nameof(wrapped));
 }