Пример #1
0
        public void Select()
        {
            bool             result          = false;
            BAudit           bAudit          = new BAudit();
            List <EAudit>    listAudit       = new List <EAudit>();
            BClient          bClient         = new BClient();
            EClient          eClient         = new EClient();
            EClient          selectedEClient = new EClient();
            TransactionScope ts = new TransactionScope(TransactionScopeOption.RequiresNew);

            eClient.CodeTypeDocumentIdentity = "0";
            eClient.NumberIdentity           = Aleatory.GetString(11);
            eClient.FirstName          = Aleatory.GetString(8);
            eClient.SecondName         = Aleatory.GetString(8);
            eClient.FatherLastName     = Aleatory.GetString(8);
            eClient.MotherLastName     = Aleatory.GetString(8);
            eClient.Audit.UserRegister = Aleatory.GetString(8);
            EClient insertedEClient = bClient.Insert(eClient);

            selectedEClient = bClient.Select(insertedEClient);

            if (selectedEClient != null &&
                selectedEClient.CodeClient == insertedEClient.CodeClient &&
                selectedEClient.SearchName == insertedEClient.SearchName &&
                selectedEClient.State == insertedEClient.State)
            {
                result = true;
            }

            ts.Dispose();

            Assert.IsTrue(result);
        }
Пример #2
0
        public void Delete()
        {
            bool             result    = false;
            BAudit           bAudit    = new BAudit();
            List <EAudit>    listAudit = new List <EAudit>();
            BClient          bClient   = new BClient();
            EClient          eClient   = new EClient();
            TransactionScope ts        = new TransactionScope(TransactionScopeOption.RequiresNew);

            eClient.CodeTypeDocumentIdentity = "0";
            eClient.NumberIdentity           = Aleatory.GetString(8);
            eClient.FirstName          = Aleatory.GetString(8);
            eClient.SecondName         = Aleatory.GetString(8);
            eClient.FatherLastName     = Aleatory.GetString(8);
            eClient.MotherLastName     = Aleatory.GetString(8);
            eClient.Audit.UserRegister = Aleatory.GetString(8);
            EClient insertedEClient = bClient.Insert(eClient);

            if (insertedEClient != null)
            {
                insertedEClient.Audit.UserRegister = Aleatory.GetString(8);
                bClient.Delete(insertedEClient);

                EClient deletedEClient = bClient.Select(eClient);

                listAudit = bAudit.Select(eClient.Audit);

                if (deletedEClient == null &&
                    listAudit.Count > 0 &&
                    listAudit.Exists(
                        x => x.UserRegister == insertedEClient.Audit.UserRegister &&
                        x.Code == insertedEClient.CodeClient.ToString() &&
                        x.TypeEvent == "Delete"))
                {
                    result = true;
                }
            }

            ts.Dispose();

            Assert.IsTrue(result);
        }