Пример #1
0
 public void GetByErroneousIdFeaturey()
 {
     using (var db = new EntitesContext())
     {
         featureDAO = new DbFeatureDAO(db);
         Assert.ThrowsException <ArgumentException>(() => featureDAO.GetById(erroneousId));
     }
 }
Пример #2
0
        public Feature GetById(int id)
        {
            if (id < 1)
            {
                throw new ArgumentException(nameof(id));
            }

            return(featureDAO.GetById(id));
        }
Пример #3
0
        public void GetByIdNoDBFeature()
        {
            Feature getById;

            using (var db = new EntitesContext())
            {
                ClearTable.Features(db);
                featureDAO = new DbFeatureDAO(db);
                getById    = featureDAO.GetById(1);
            }
            Assert.IsNull(getById);
        }
Пример #4
0
        public void GetByIdFeature()
        {
            Feature getById;
            Feature featureExpected = CreateNew(1);

            using (var db = new EntitesContext())
            {
                ClearTable.Features(db);
                featureDAO = new DbFeatureDAO(db);
                featureDAO.Add(CreateNew());
                getById = featureDAO.GetById(1);
            }

            Assert.AreEqual(getById, featureExpected);
        }