public void Cloning_the_interception_context_preserves_contextual_information_but_not_mutable_state() { var objectContext = new ObjectContext(); var dbContext = DbContextMockHelper.CreateDbContext(objectContext); var interceptionContext = new DbCommandInterceptionContext<string>(); var mutableData = ((IDbMutableInterceptionContext<string>)interceptionContext).MutableData; mutableData.SetExecuted("Wensleydale"); mutableData.SetExceptionThrown(new Exception("Cheez Whiz")); mutableData.UserState = new object(); interceptionContext = interceptionContext .WithDbContext(dbContext) .WithObjectContext(objectContext) .AsAsync() .WithCommandBehavior(CommandBehavior.SchemaOnly); Assert.Equal(new[] { objectContext }, interceptionContext.ObjectContexts); Assert.Equal(new[] { dbContext }, interceptionContext.DbContexts); Assert.True(interceptionContext.IsAsync); Assert.Equal(CommandBehavior.SchemaOnly, interceptionContext.CommandBehavior); Assert.Null(interceptionContext.Result); Assert.Null(interceptionContext.OriginalResult); Assert.Null(interceptionContext.Exception); Assert.Null(interceptionContext.OriginalException); Assert.Null(interceptionContext.UserState); Assert.False(interceptionContext.IsExecutionSuppressed); }