示例#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);
        }