Esempio n. 1
0
        public void GivenNewAccount_WhenInsert_ThenReturnNotNull()
        {
            var uow = new UoW(_chatContext);

            using (var dbContextTransaction = uow.BeginTransaction())
            {
                try
                {
                    //ARRANGE
                    Account account = new Account();
                    account.UserName = "******";
                    account.Password = "******";

                    _sendEmailStub.Stub(se => se.Send("", "", "")).IgnoreArguments().Return(true);

                    //ACT
                    var newaccount = _sut.AddAccount(account, null);

                    //ASSERT
                    var insertedAccount = _accountRepository.Get(account.AccountID);
                    Assert.NotNull(insertedAccount);
                    Assert.Equal(insertedAccount.Password, newaccount.Password);
                }
                finally
                {
                    dbContextTransaction.Rollback();
                }
            }
        }