Ejemplo n.º 1
0
 public void TestSuccess1()
 {
     _NewAccount.IsAcceptEmail    = true;
     _NewAccount.IsAcceptSMS      = true;
     _NewAccount.IsValidateUsbKey = false;
     Expect.Call(_IAccountDal.GetAccountById(_NewAccount.Id)).Return(_CurrentAccount);
     Expect.Call(delegate { _IAccountDal.UpdateAccount(_CurrentAccount); });
     mocks.ReplayAll();
     _Target = new SavePersonalConfig(_IAccountDal, _NewAccount, null);
     _Target.Excute();
     mocks.ReplayAll();
     Assert.AreEqual(_NewAccount.IsAcceptEmail, _CurrentAccount.IsAcceptEmail);
     Assert.AreEqual(_NewAccount.IsAcceptSMS, _CurrentAccount.IsAcceptSMS);
     Assert.AreEqual(_NewAccount.IsValidateUsbKey, _CurrentAccount.IsValidateUsbKey);
 }
Ejemplo n.º 2
0
        public void TestFailure2()
        {
            _NewAccount.IsAcceptEmail    = true;
            _NewAccount.IsAcceptSMS      = true;
            _NewAccount.IsValidateUsbKey = true;
            Expect.Call(_IAccountDal.GetAccountById(_NewAccount.Id)).Return(_CurrentAccount);
            mocks.ReplayAll();
            _Target = new SavePersonalConfig(_IAccountDal, _NewAccount, null);
            bool isException = false;

            try
            {
                _Target.Excute();
            }
            catch (Exception ex)
            {
                Assert.AreEqual(ex.Message, "UsbKey没有生成,请生成UsbKey后,再开启UsbKey身份认证!");
                isException = true;
            }
            mocks.ReplayAll();
            Assert.AreEqual(isException, true);
        }
Ejemplo n.º 3
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);
        }
Ejemplo n.º 4
0
        public void SavePersonalConfig(Account loginUser, byte[] electronIdiograph)
        {
            SavePersonalConfig SavePersonalConfig = new SavePersonalConfig(loginUser, electronIdiograph);

            SavePersonalConfig.Excute();
        }