예제 #1
0
        public void Dispose_RemovedDbSets()
        {
            // Arrange
            _mockContext = new MockEfContext(typeof(TestEntity));

            // Act
            _mockContext.Object.Dispose();

            // Assert
            Assert.ThrowsException <NullReferenceException>(() => _mockContext.GetDbSet <TestEntity>(), "The dbset should not exist once the context has been disposed.");
        }
예제 #2
0
 public void GetDbSet_ForNonExistingType_ThrowsException()
 {
     // Assert
     Assert.ThrowsException <KeyNotFoundException>(() => _mockContext.GetDbSet <string>());
 }