public ActionResult Process(HttpRequestBase request, ModelStateDictionary modelState)
        {
            PdtVerificationBinder binder = new PdtVerificationBinder();
            Transaction tx = binder.Bind(request.Form, modelState);

            ContentResult cr = new ContentResult();
            cr.ContentEncoding = Encoding.UTF8;
            cr.ContentType = "text/html";
            cr.Content = "FAIL\n";

            if (tx != null)
            {
                Transaction dbTx = m_txRepository.GetAll().Where(x => x.Tx == tx.Tx).FirstOrDefault();
                if (dbTx != null && dbTx.AuthToken == tx.AuthToken)
                {
                    StringBuilder sb = new StringBuilder();
                    sb.Append("SUCCESS\n");
                    sb.Append(BuildContent(dbTx));

                    cr.Content = sb.ToString();
                }
            }

            return cr;
        }
        public void ShouldFailIfMissingTx()
        {
            // Arrange
            PdtVerificationBinder binder = new PdtVerificationBinder();

            NameValueCollection form = new NameValueCollection {
                { "at", m_at },
            };

            // Act
            Transaction p = binder.Bind(form, m_modelState);

            // Assert
            Assert.AreEqual(null, p);
            Assert.IsFalse(m_modelState.IsValid);
        }
        public void ShouldBindTx()
        {
            // Arrange
            PdtVerificationBinder binder = new PdtVerificationBinder();

            NameValueCollection form = new NameValueCollection {
                { "at", m_at },
                { "tx", m_tx }
            };

            // Act
            Transaction p = binder.Bind(form, m_modelState);

            // Assert
            Assert.AreEqual(m_at, p.AuthToken);
            Assert.AreEqual(m_tx, p.Tx);
        }