Esempio n. 1
0
 public StudentsUnitOfWork(StudentsContext context)
 {
     this.context = context;
     Department   = new RepositoryDepartment(context);
     Student      = new RepositoryStudent(context);
     Subject      = new RepositorySubject(context);
 }
        public void Remove_NotAdded_NoOp()
        {
            var subject           = new InMemoryRepository <RepositorySubject, int>(1, 2);
            var nonExistingEntity = new RepositorySubject(3);

            subject.Remove(nonExistingEntity);
            Assert.That(subject.Count(), Is.EqualTo(2));
        }
        public void Remove_NotAddedButSameId_RemovesThem()
        {
            var subject        = new InMemoryRepository <RepositorySubject, int>(1, 2);
            var existingEntity = new RepositorySubject(1);

            subject.Remove(existingEntity);
            Assert.That(subject.Count(), Is.EqualTo(1));
            Assert.That(subject.Find(1), Is.Empty);
        }