public void GetByFeatureClient() { List <Client> getByFeature; using (var db = new EntitesContext()) { ClearTable.Features(db); ClearTable.KeyFeatures(db); ClearTable.Clients(db); ClearTable.KeyFeatureClients(db); clientL = Get(db); db.Features.AddRange(CreateListEntities.Features()); db.KeyFeatures.AddRange(CreateListEntities.KeyFeatures()); db.Clients.AddRange(CreateListEntities.Clients()); db.KeyFeatureClients.AddRange(CreateListEntities.KeyFeatureClients()); db.SaveChanges(); getByFeature = clientL.GetByFeature(new Feature { Id = 1, Number = 1, Name = "qwe", }); } CollectionAssert.AreEqual(getByFeature, CreateListEntities.Clients()); }
public void GetAllFeature() { var getAll = new List <Feature>(); var features = CreateListEntities.Features(); using (var db = new EntitesContext()) { ClearTable.Features(db); featureDAO = new DbFeatureDAO(db); foreach (var feat in features) { featureDAO.Add(feat); } getAll = featureDAO.GetAll(); } CollectionAssert.AreEqual(getAll, features); }
public void RemoveFeature() { bool remove; using (var db = new EntitesContext()) { ClearTable.Features(db); ClearTable.KeyFeatures(db); ClearTable.KeyFeatureClients(db); featureDAO = new DbFeatureDAO(db); db.Features.AddRange(CreateListEntities.Features()); db.KeyFeatures.AddRange(CreateListEntities.KeyFeatures()); db.KeyFeatureClients.AddRange(CreateListEntities.KeyFeatureClients()); db.SaveChanges(); remove = featureDAO.Remove(1); } Assert.IsTrue(remove); }