예제 #1
0
 public void GetByErroneousIdKeyFeaturey()
 {
     using (var db = new EntitesContext())
     {
         kfDAO = new DbKeyFeatureDAO(db);
         Assert.ThrowsException <ArgumentException>(() => kfDAO.GetById(erroneousId));
     }
 }
예제 #2
0
        public KeyFeature GetById(int id)
        {
            if (id < 1)
            {
                throw new ArgumentException(nameof(id));
            }

            return(keyFeatureDAO.GetById(id));
        }
예제 #3
0
        public void GetByIdNoDBKeyFeature()
        {
            KeyFeature getById;

            using (var db = new EntitesContext())
            {
                ClearTable.KeyFeatures(db);
                kfDAO   = new DbKeyFeatureDAO(db);
                getById = kfDAO.GetById(1);
            }

            Assert.IsNull(getById);
        }
예제 #4
0
        public void GetByIdKeyFeature()
        {
            KeyFeature getById;
            KeyFeature kfExpected = CreateNew(1);

            using (var db = new EntitesContext())
            {
                ClearTable.KeyFeatures(db);
                kfDAO = new DbKeyFeatureDAO(db);
                kfDAO.Add(CreateNew());
                getById = kfDAO.GetById(1);
            }

            Assert.AreEqual(getById, kfExpected);
        }