public void ShouldCommit()
        {
            // arrange
            TransactionAttribute.FactoryResolver = Resolver.Get;
            TransactionAttribute attr = new TransactionAttribute();
            Resolver.Reset();

            // act
            attr.OnResultExecuted(m_context);

            // assert
            Resolver.Factory.Verify(x => x.GetCurrentUnitOfWork());
            Resolver.UoW.Verify(x => x.Commit());
        }
        public void ShouldNotCommitIfNullUoW()
        {
            // arrange
            Resolver.Get();
            TransactionAttribute.FactoryResolver = Resolver.Get;
            TransactionAttribute attr = new TransactionAttribute();
            //Resolver.Reset();
            Resolver.ReturnNullUoW = true;

            // act
            attr.OnResultExecuted(m_context);

            // assert
            Resolver.Factory.Verify(x => x.GetCurrentUnitOfWork());
        }
        public void ShouldNotCommitIfModelStateInvalid()
        {
            // arrange
            Resolver.Get();
            TransactionAttribute.FactoryResolver = Resolver.Get;
            TransactionAttribute attr = new TransactionAttribute();
            m_context.Controller.ViewData.ModelState.AddModelError("Data", "Error");
            //Resolver.Reset();

            // act
            attr.OnResultExecuted(m_context);

            // assert
            Resolver.Factory.Verify(x => x.GetCurrentUnitOfWork(), Times.Never());
        }