Exemplo n.º 1
0
        public void GetByFeatureClient()
        {
            List <Client> getByFeature;

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

                clientDAO = new DbClientDAO(db);
                db.Features.AddRange(CreateListEntities.Features());
                db.KeyFeatures.AddRange(CreateListEntities.KeyFeatures());
                db.Clients.AddRange(CreateListEntities.Clients());
                db.KeyFeatureClients.AddRange(CreateListEntities.KeyFeatureClients());
                db.SaveChanges();

                getByFeature = clientDAO.GetByFeature(new Feature
                {
                    Id     = 1,
                    Number = 1,
                    Name   = "qwe",
                });
            }

            CollectionAssert.AreEqual(getByFeature, CreateListEntities.Clients());
        }
Exemplo n.º 2
0
 public void GetByNullFeatureClient()
 {
     using (var db = new EntitesContext())
     {
         clientDAO = new DbClientDAO(db);
         Assert.ThrowsException <ArgumentNullException>(() => clientDAO.GetByFeature(null));
     }
 }
Exemplo n.º 3
0
        public List <Client> GetByFeature(Feature feature)
        {
            if (feature == null)
            {
                throw new ArgumentNullException(nameof(feature));
            }

            return(clientDAO.GetByFeature(feature));
        }