public void RemoveErroneousIdFeature() { using (var db = new EntitesContext()) { featureL = Get(db); Assert.ThrowsException <ArgumentException>(() => featureL.Remove(erroneousId)); } }
public void SaveNullFeature() { using (var db = new EntitesContext()) { featureL = Get(db); Assert.ThrowsException <ArgumentNullException>(() => featureL.Save(null)); } }
public void RemoveNoDBFeature() { using (var db = new EntitesContext()) { ClearTable.Features(db); featureL = Get(db); featureL.Save(CreateNew()); Assert.IsFalse(featureL.Remove(1235)); } }
public void GetByIdNoDBFeature() { Feature getById; using (var db = new EntitesContext()) { ClearTable.Features(db); featureL = Get(db); getById = featureL.GetById(1); } Assert.IsNull(getById); }
public void SaveFeature() { bool add; using (var db = new EntitesContext()) { ClearTable.Features(db); featureL = Get(db); add = featureL.Save(CreateNew()); } Assert.IsTrue(add); }
public KeyFeatureModel(IFactoryLogic factoryLogic) { this.factoryLogic = factoryLogic ?? throw new ArgumentNullException(nameof(factoryLogic)); db = Context.GetContext(); if (db == null) { throw new ArgumentNullException(nameof(db)); } featLogic = this.factoryLogic.CreateFeature(db); keyFeatureLogic = this.factoryLogic.CreateKeyFeature(db); }
public FeatureModel(IFactoryLogic factoryLogic) { if (factoryLogic == null) { throw new ArgumentNullException(nameof(factoryLogic)); } db = Context.GetContext(); if (db == null) { throw new ArgumentNullException(nameof(db)); } featLogic = factoryLogic.CreateFeature(db); }
public void GetAllEmptyFeature() { var getAll = new List <Feature>(); var featureExpected = new List <Feature>(); using (var db = new EntitesContext()) { ClearTable.Features(db); featureL = Get(db); getAll = featureL.GetAll(); } CollectionAssert.AreEqual(getAll, featureExpected); }
public void GetByIdFeature() { Feature getById; Feature featureExpected = CreateNew(1); using (var db = new EntitesContext()) { ClearTable.Features(db); featureL = Get(db); featureL.Save(CreateNew()); getById = featureL.GetById(1); } Assert.AreEqual(getById, featureExpected); }
public void SaveDuplicateFeature() { bool add; Feature feature = CreateNew(); using (var db = new EntitesContext()) { ClearTable.Features(db); featureL = Get(db); featureL.Save(feature); add = featureL.Save(feature); } Assert.IsFalse(add); }
public void UpdateDuplicateFeature() { bool update; var faeture = CreateNew(); using (var db = new EntitesContext()) { ClearTable.Features(db); featureL = Get(db); featureL.Save(faeture); faeture.Number = 111; featureL.Save(faeture); update = featureL.Update(CreateNew(2)); } Assert.IsFalse(update); }
public void UpdateNoDBFeature() { var featureNoDB = new Feature { Id = 234234, Number = 54, Name = "____________", Description = "ssdsssss", }; using (var db = new EntitesContext()) { ClearTable.Features(db); featureL = Get(db); featureL.Save(CreateNew()); Assert.IsFalse(featureL.Update(featureNoDB)); } }
public void UpdateFeature() { bool update; using (var db = new EntitesContext()) { ClearTable.Features(db); featureL = Get(db); featureL.Save(CreateNew()); update = featureL.Update(new Feature { Id = 1, Number = 1002, Name = "TestUpdate", Description = "Test ______", }); } Assert.IsTrue(update); }
public void GetAllFeature() { var getAll = new List <Feature>(); var features = CreateListEntities.Features(); using (var db = new EntitesContext()) { ClearTable.Features(db); featureL = Get(db); foreach (var feat in features) { featureL.Save(feat); } getAll = featureL.GetAll(); } CollectionAssert.AreEqual(getAll, features); }
public void ErroneousArgumentSaveFeature() { Feature feature = CreateNew(); using (var db = new EntitesContext()) { ClearTable.Features(db); featureL = Get(db); feature.Name = null; Assert.ThrowsException <ArgumentException>(() => featureL.Save(feature)); feature.Name = string.Empty; Assert.ThrowsException <ArgumentException>(() => featureL.Save(feature)); feature.Name = "_____"; feature.Number = 0; Assert.ThrowsException <ArgumentException>(() => featureL.Save(feature)); feature.Number = -456; Assert.ThrowsException <ArgumentException>(() => featureL.Save(feature)); } }
public void RemoveFeature() { bool remove; using (var db = new EntitesContext()) { ClearTable.Features(db); ClearTable.KeyFeatures(db); ClearTable.KeyFeatureClients(db); featureL = Get(db); db.Features.AddRange(CreateListEntities.Features()); db.KeyFeatures.AddRange(CreateListEntities.KeyFeatures()); db.KeyFeatureClients.AddRange(CreateListEntities.KeyFeatureClients()); db.SaveChanges(); remove = featureL.Remove(1); } Assert.IsTrue(remove); }
public FeatureController(IFeatureLogic featureLogic) { _featureLogic = featureLogic; }
public void NullEntitesContextFeature() { Assert.ThrowsException <ArgumentNullException>(() => featureL = Get(null)); }