예제 #1
0
        protected override void ExcuteSelf()
        {
            using (TransactionScope ts = new TransactionScope(TransactionScopeOption.Required))
            {
                _CurrentAccount.IsAcceptEmail    = _Account.IsAcceptEmail;
                _CurrentAccount.IsAcceptSMS      = _Account.IsAcceptSMS;
                _CurrentAccount.IsValidateUsbKey = _Account.IsValidateUsbKey;

                _IAccountDal.UpdateAccount(_CurrentAccount);
                if (_ElectronIdiograph != null && _ElectronIdiograph.Length > 0)
                {
                    ////更新电子签名
                    _IAccountDal.DeleteElectronIdiographByAccountID(_Account.Id);
                    _IAccountDal.InsertElectronIdiograph(_Account.Id, _ElectronIdiograph);
                }
                ts.Complete();
            }
        }
예제 #2
0
        public void TestSuccess2()
        {
            _NewAccount.IsAcceptEmail    = true;
            _NewAccount.IsAcceptSMS      = true;
            _NewAccount.IsValidateUsbKey = true;
            _CurrentAccount.UsbKey       = "ssss";
            Expect.Call(_IAccountDal.GetAccountById(_NewAccount.Id)).Return(_CurrentAccount);
            Expect.Call(delegate { _IAccountDal.UpdateAccount(_CurrentAccount); });

            ////更新电子签名
            byte[] electronIdiograph = new byte[1];
            Expect.Call(delegate { _IAccountDal.DeleteElectronIdiographByAccountID(_NewAccount.Id); });
            Expect.Call(delegate { _IAccountDal.InsertElectronIdiograph(_NewAccount.Id, electronIdiograph); }).
            IgnoreArguments();
            mocks.ReplayAll();
            _Target = new SavePersonalConfig(_IAccountDal, _NewAccount, electronIdiograph);
            _Target.Excute();
            mocks.ReplayAll();
            Assert.AreEqual(_NewAccount.IsAcceptEmail, _CurrentAccount.IsAcceptEmail);
            Assert.AreEqual(_NewAccount.IsAcceptSMS, _CurrentAccount.IsAcceptSMS);
            Assert.AreEqual(_NewAccount.IsValidateUsbKey, _CurrentAccount.IsValidateUsbKey);
        }