Example #1
0
 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));
 }
Example #2
0
 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);
 }
Example #3
0
        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));
        }
Example #4
0
 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);
 }