public void Test_Repository_Save() { _repository = new Repository <MockStoreable, int>(); _newRepoObject = new MockStoreable { Id = 100 }; _repository.Save(_newRepoObject); _allRepoObjects = _repository.GetAll(); Assert.IsTrue(_allRepoObjects.Contains(_newRepoObject)); }
public void Test_Repository_GetById() { _repository = new Repository <MockStoreable, int>(); _existingRepoObject = new MockStoreable { Id = 100 }; _repository.Save(_existingRepoObject); _expectedRepoObject = _repository.Get(100); Assert.AreEqual(_expectedRepoObject.Id, _existingRepoObject.Id); }
public void Test_Repository_Delete() { _repository = new Repository <MockStoreable, int>(); _existingRepoObject = new MockStoreable { Id = 100 }; _repository.Save(_existingRepoObject); _repository.Delete(100); _allRepoObjects = _repository.GetAll(); Assert.IsFalse(_allRepoObjects.Contains(_existingRepoObject)); }
public void Test_Repository_Save_NoDuplicates() { _repository = new Repository <MockStoreable, int>(); _existingRepoObject = new MockStoreable { Id = 100 }; _repository.Save(_newRepoObject); _newRepoObject = new MockStoreable { Id = 100 }; _repository.Save(_newRepoObject); _allRepoObjects = _repository.GetAll(); Assert.AreEqual(_allRepoObjects.Count(), 1); }