public void SaveDuplicateKeyFeature() { bool add; using (var db = new EntitesContext()) { ClearTable.KeyFeatures(db); keyFeatureL = Get(db); keyFeatureL.Save(CreateNew()); add = keyFeatureL.Save(CreateNew()); } Assert.IsFalse(add); }
public void SaveNullKeyFeature() { using (var db = new EntitesContext()) { keyFeatureL = Get(db); Assert.ThrowsException <ArgumentNullException>(() => keyFeatureL.Save(null)); } }
public void RemoveNoDBKeyFeature() { using (var db = new EntitesContext()) { ClearTable.KeyFeatures(db); keyFeatureL = Get(db); keyFeatureL.Save(CreateNew()); Assert.IsFalse(keyFeatureL.Remove(123)); } }
public void ErroneousArgumentSaveKeyFeature() { KeyFeature keyFeature = CreateNew(); using (var db = new EntitesContext()) { ClearTable.KeyFeatures(db); keyFeatureL = Get(db); keyFeature.IdFeature = 0; Assert.ThrowsException <ArgumentException>(() => keyFeatureL.Save(keyFeature)); keyFeature.IdFeature = -12; Assert.ThrowsException <ArgumentException>(() => keyFeatureL.Save(keyFeature)); keyFeature.IdFeature = 45; keyFeature.IdHaspKey = 0; Assert.ThrowsException <ArgumentException>(() => keyFeatureL.Save(keyFeature)); keyFeature.IdHaspKey = -12; Assert.ThrowsException <ArgumentException>(() => keyFeatureL.Save(keyFeature)); keyFeature.StartDate = keyFeature.EndDate.AddDays(-45); Assert.ThrowsException <ArgumentException>(() => keyFeatureL.Save(keyFeature)); } }
public void GetByIdKeyFeature() { KeyFeature getById; KeyFeature kfExpected = CreateNew(1); using (var db = new EntitesContext()) { ClearTable.KeyFeatures(db); keyFeatureL = Get(db); keyFeatureL.Save(CreateNew()); getById = keyFeatureL.GetById(1); } Assert.AreEqual(getById, kfExpected); }
public void UpdateDuplicateKeyKeyFeature() { bool update; var keyFeature = CreateNew(); using (var db = new EntitesContext()) { ClearTable.KeyFeatures(db); keyFeatureL = Get(db); keyFeatureL.Save(keyFeature); keyFeature.IdFeature = 111; update = keyFeatureL.Update(CreateNew(2)); } Assert.IsFalse(update); }
public void UpdateNoDBKeyFeature() { var kfNoDB = new KeyFeature { Id = 32, IdFeature = 3, IdHaspKey = 24, EndDate = date.AddDays(100), StartDate = date, }; using (var db = new EntitesContext()) { ClearTable.KeyFeatures(db); keyFeatureL = Get(db); keyFeatureL.Save(CreateNew()); Assert.IsFalse(keyFeatureL.Update(kfNoDB)); } }
public void UpdateKeyFeature() { bool update; using (var db = new EntitesContext()) { ClearTable.KeyFeatures(db); keyFeatureL = Get(db); keyFeatureL.Save(CreateNew()); update = keyFeatureL.Update(new KeyFeature { Id = 1, IdFeature = 2, IdHaspKey = 3, StartDate = date.AddDays(5), EndDate = date.AddDays(10), }); } Assert.IsTrue(update); }