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 RemoveClient() { bool remove; using (var db = new EntitesContext()) { ClearTable.Clients(db); ClearTable.KeyFeatureClients(db); clientL = Get(db); db.Clients.AddRange(CreateListEntities.Clients()); db.KeyFeatureClients.AddRange(CreateListEntities.KeyFeatureClients()); db.SaveChanges(); remove = clientL.Remove(1); } Assert.IsTrue(remove); }
public void GetAllClient() { List <Client> getAll; var clients = CreateListEntities.Clients(); using (var db = new EntitesContext()) { ClearTable.Clients(db); clientL = Get(db); foreach (var cl in clients) { clientL.Save(cl); } getAll = clientL.GetAll(); } CollectionAssert.AreEqual(getAll, clients); }
public void GetByNumberKeyClient() { Client getByNumberKey; Client actual = CreateListEntities.Clients()[0]; using (var db = new EntitesContext()) { ClearTable.HaspKeys(db); ClearTable.KeyFeatures(db); ClearTable.Clients(db); ClearTable.KeyFeatureClients(db); clientL = Get(db); db.HaspKeys.AddRange(CreateListEntities.HaspKeys()); db.KeyFeatures.AddRange(CreateListEntities.KeyFeatures()); db.Clients.AddRange(CreateListEntities.Clients()); db.KeyFeatureClients.AddRange(CreateListEntities.KeyFeatureClients()); db.SaveChanges(); getByNumberKey = clientL.GetByNumberKey(1); } Assert.AreEqual(getByNumberKey, actual); }