Beispiel #1
0
 public void GetByErroneousNumberKeyClient()
 {
     using (var db = new EntitesContext())
     {
         clientL = Get(db);
         Assert.ThrowsException <ArgumentException>(() => clientL.GetByNumberKey(erroneousId));
     }
 }
Beispiel #2
0
 public void GetByNumberKeyNoDBClient()
 {
     using (var db = new EntitesContext())
     {
         ClearTable.HaspKeys(db);
         clientL = Get(db);
         Assert.IsNull(clientL.GetByNumberKey(2));
     }
 }
Beispiel #3
0
        public ModelViewClient GetByNumberKey(int keyInnerId)
        {
            Client client = clientLogic.GetByNumberKey(keyInnerId);

            if (client == null)
            {
                return(null);
            }
            return(new ModelViewClient(client));
        }
Beispiel #4
0
        public void GetByNumberKeyClient()
        {
            Client getByNumberKey;
            Client actual = CreateListEntities.Clients()[0];

            using (var db = new EntitesContext())
            {
                ClearTable.HaspKeys(db);
                ClearTable.KeyFeatures(db);
                ClearTable.Clients(db);
                ClearTable.KeyFeatureClients(db);

                clientL = Get(db);
                db.HaspKeys.AddRange(CreateListEntities.HaspKeys());
                db.KeyFeatures.AddRange(CreateListEntities.KeyFeatures());
                db.Clients.AddRange(CreateListEntities.Clients());
                db.KeyFeatureClients.AddRange(CreateListEntities.KeyFeatureClients());
                db.SaveChanges();

                getByNumberKey = clientL.GetByNumberKey(1);
            }

            Assert.AreEqual(getByNumberKey, actual);
        }