test/Shared/FunctionalTests/ProductivityApi/DisposeTests.cs
/// <summary>
/// Asserts that an operation on a set from a disposed context throws, but only when the operation is
/// executed, not when the set is created.
/// </summary>
/// <typeparam name="TEntity"> The type of entity for which a set should be created. </typeparam>
/// <param name="test"> The test to run on the set. </param>
Asserts that an operation on a set from a disposed context throws, but only when the operation is
executed, not when the set is created.
Asserts that an operation on a set from a disposed context throws but only when the operation is executed not when the set is created .
private void ThrowsWithDisposedContext<TEntity>(Action<IDbSet<TEntity>> test) where TEntity : class
        {
            var context = CreateDisposedContext();
            var set = context.Set<TEntity>();
            Assert.Throws<InvalidOperationException>(() => test(set)).ValidateMessage("DbContext_Disposed");
        }
private void ThrowsWithDisposedContext < TEntity > ( Action < IDbSet < TEntity > > test ) where TEntity : class { var context = CreateDisposedContext ( ) ; var set = context . Set < TEntity > ( ) ; Assert . Throws < InvalidOperationException > ( ( ) => test ( set ) ) . ValidateMessage ( " " ) ; }
Asserts that an operation on a set from a disposed context throws, but only when the operation is
executed, not when the set is created.
Asserts that an operation on a set from a disposed context throws but only when the operation is executed not when the set is created .
// Does not throw even though context is disposed. // Now throws
test
Action<IDbSet<TEntity>>
The test to run on the set.
The test to run on the set .
typeparam
The type of entity for which a set should be created.
The type of entity for which a set should be created .