Beispiel #1
0
        public void GetByWrongId_Null()
        {
            // Arrange
            NonGenericRepository subjectRepository = new NonGenericRepository(dbContext, typeof(Subject));
            Guid    wrongId = default(Guid);
            Subject expectedSubjectFromDb = null;

            // Act
            Subject actualSubjectFromDb = subjectRepository.Get(wrongId) as Subject;

            // Assert
            Assert.AreEqual(expectedSubjectFromDb, actualSubjectFromDb);
        }
Beispiel #2
0
        public void GetById()
        {
            // Arrange
            NonGenericRepository subjectRepository = new NonGenericRepository(dbContext, typeof(Subject));
            Guid    idToSearch      = dbContext.Subjects.First().Id;
            Subject expectedSubject = dbContext.Subjects.Find(idToSearch);

            // Act
            Subject subjectFromDB = subjectRepository.Get(idToSearch) as Subject;

            // Assert
            Assert.AreEqual(expectedSubject, subjectFromDB);
        }