Accelergreat.EntityFramework 4.0.2

Prefix Reserved
dotnet add package Accelergreat.EntityFramework --version 4.0.2
                    
NuGet\Install-Package Accelergreat.EntityFramework -Version 4.0.2
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Accelergreat.EntityFramework" Version="4.0.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Accelergreat.EntityFramework" Version="4.0.2" />
                    
Directory.Packages.props
<PackageReference Include="Accelergreat.EntityFramework" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Accelergreat.EntityFramework --version 4.0.2
                    
#r "nuget: Accelergreat.EntityFramework, 4.0.2"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Accelergreat.EntityFramework@4.0.2
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Accelergreat.EntityFramework&version=4.0.2
                    
Install as a Cake Addin
#tool nuget:?package=Accelergreat.EntityFramework&version=4.0.2
                    
Install as a Cake Tool

uid: DeveloperDocumentation.Index

⚡ Accelergreat 4.0 - Ultra Fast Integration Tests

The fastest way to write and run integration tests in .NET

Stop fighting with slow, brittle integration tests. Accelergreat automatically manages your test dependencies, runs tests in parallel, and resets databases in milliseconds. Focus on writing great tests, not test infrastructure.

🚀 Why Developers Love Accelergreat

Lightning Fast Database Resets

  • Transactions Mode: 0-3ms database resets using savepoints
  • Parallel Execution: Tests run simultaneously across multiple environments
  • Smart Pooling: Intelligent resource management scales with your machine

Zero Boilerplate

  • Auto-managed Dependencies: Databases, APIs, and services configured automatically
  • Clean Test Code: No setup/teardown code cluttering your tests
  • Familiar APIs: Works with your existing xUnit knowledge

Production-Ready

  • Multiple Database Providers: SQL Server, SQLite
  • Microservices Support: Test complex multi-service scenarios
  • Environment Configuration: Development and CI configs

🎯 Quick Start (2 minutes)

1. Install Accelergreat

    dotnet add package Accelergreat.Xunit
dotnet add package Accelergreat.EntityFramework.SqlServer

2. Configure Components

public class Startup : IAccelergreatStartup
{
    public void Configure(IAccelergreatBuilder builder)
    {
        builder.AddAccelergreatComponent<ProductDatabaseComponent>();
        builder.AddAccelergreatComponent<ProductApiComponent>();
    }
}

public class ProductDatabaseComponent : SqlServerEntityFrameworkDatabaseComponent<ProductDbContext>
{
    public ProductDatabaseComponent(IConfiguration configuration) : base(configuration)
    {
    }
}

3. Create Your First Test

public class ProductTests : AccelergreatXunitTest
{
    public ProductTests(IAccelergreatEnvironmentPool environmentPool) : base(environmentPool)
    {
    }

    [Fact]
    public async Task CreateProduct_ShouldPersistToDatabase()
    {
        // Arrange - Get auto-managed database
        var dbContext = GetComponent<ProductDatabaseComponent>().DbContextFactory.NewDbContext();
        var product = new Product { Name = "Test Product", Price = 99.99m };

        // Act
        dbContext.Products.Add(product);
        await dbContext.SaveChangesAsync();

        // Assert
        var saved = await dbContext.Products.FindAsync(product.Id);
        saved.Should().NotBeNull();
        saved.Name.Should().Be("Test Product");
        
        // Database automatically resets after each test!
    }
}

4. Run Tests

dotnet test

That's it! Your tests now run in parallel with ultra-fast database resets.


🏗️ NuGet Packages

NuGet .NET

Core Packages

Package Description
Accelergreat.Xunit xUnit integration & test framework
Accelergreat Core package for custom components

Database Packages

Database Package
SQL Server Accelergreat.EntityFramework.SqlServer
SQLite Accelergreat.EntityFramework.Sqlite

Application Packages

Type Package
Web APIs Accelergreat.Web

✨ New in v4.0: Full .NET 9 support, enhanced performance, improved diagnostics


🧩 Component Architecture

Components are the heart of Accelergreat. They represent your test dependencies and handle all the heavy lifting.

Database Components

SQL Server with Lightning-Fast Resets
public class OrderDatabaseComponent : SqlServerEntityFrameworkDatabaseComponent<OrderDbContext>
{
    public OrderDatabaseComponent(IConfiguration configuration) : base(configuration)
    {
    }

    // Optional: Add global test data
    protected override async Task OnDatabaseInitializedAsync(OrderDbContext context)
    {
        context.Categories.Add(new Category { Name = "Electronics" });
        await context.SaveChangesAsync();
    }
}
Configuration for Different Environments
// accelergreat.development.json
{
  "SqlServerEntityFramework": {
    "ResetStrategy": "Transactions",  // 0-3ms resets!
    "CreateStrategy": "Migrations"
  }
}

// accelergreat.ci.json  
{
  "SqlServerEntityFramework": {
    "ResetStrategy": "SnapshotRollback",  // 80-150ms resets
    "ConnectionString": "Server=ci-server;Database=TestDb;..."
  }
}

Web API Components

Test Your APIs Effortlessly
public class OrderApiComponent : WebAppComponent<OrderApi.Startup>
{
    protected override void BuildConfiguration(
        IConfigurationBuilder configurationBuilder,
        IReadOnlyAccelergreatEnvironmentPipelineData environmentData)
    {
        // Auto-inject database connection
        configurationBuilder.AddEntityFrameworkDatabaseConnectionString<OrderDbContext>(
            "DefaultConnection", environmentData);
    }
}
Modern .NET 6+ Program.cs Support
public class OrderApiComponent : WebAppComponent<Program>
{
    protected override void BuildConfiguration(
        IConfigurationBuilder configurationBuilder,
        IReadOnlyAccelergreatEnvironmentPipelineData environmentData)
    {
        configurationBuilder.AddEntityFrameworkDatabaseConnectionString<OrderDbContext>(
            "DefaultConnection", environmentData);
    }
}

Microservices Components

public class PaymentServiceComponent : KestrelWebAppComponent<PaymentService.Program>
{
    protected override void BuildConfiguration(
            IConfigurationBuilder configurationBuilder,
        IReadOnlyAccelergreatEnvironmentPipelineData environmentData)
    {
        var orderServiceUrl = environmentData.GetKestrelWebAppHttpBaseAddress<OrderService.Program>();
        configurationBuilder.AddInMemoryCollection(new[] {
            new KeyValuePair<string, string>("OrderService:BaseUrl", orderServiceUrl)
        });
    }
}

⚡ Performance Features

1. Parallel Test Execution

Accelergreat works with xUnit's parallel execution through intelligent environment pooling:

// xunit.runner.json
{
  "maxParallelThreads": 4,
  "parallelizeTestCollections": true
}

Results: Up to 5x faster test execution on multi-core machines!

2. Ultra-Fast Database Resets

Transaction Mode - 0-3ms
{
  "SqlServerEntityFramework": {
    "ResetStrategy": "Transactions"
  }
}

Uses savepoints for instant rollbacks. Perfect for development.

Snapshot Mode - 80-150ms
{
  "SqlServerEntityFramework": {
    "ResetStrategy": "SnapshotRollback"
  }
}

Creates database snapshots for reliable resets. Great for CI.

3. Environment Pooling

// Automatically manages test environments
- Environment [1] allocated  
- Environment [2] allocated
- Environment [3] allocated
// Tests run in parallel across environments

🔧 Advanced Features

Transaction Overriding

Handle nested transactions in your application code:

builder.ConfigureServices(services =>
{
    services.AddAccelergreatDbContext<OrderDbContext>(
        environmentData, 
        useTransactionOverriding: true  // Handles nested transactions
    );
});

Custom Components

Build your own components for specific needs:

public class RedisComponent : IAccelergreatComponent
{
    private ConnectionMultiplexer _redis;

    public async Task InitializeAsync(IAccelergreatEnvironmentPipelineData environmentData)
    {
        _redis = await ConnectionMultiplexer.ConnectAsync("localhost:6379");
        environmentData.Add("RedisConnection", _redis);
    }

    public async Task ResetAsync()
    {
        await _redis.GetDatabase().FlushDatabaseAsync();
    }

    public async ValueTask DisposeAsync()
    {
        await _redis.DisposeAsync();
    }
}

Environment-Based Configuration

// Set environment via environment variable
Environment.SetEnvironmentVariable("ACCELERGREAT_ENVIRONMENT", "development");

// Or configure via user secrets
dotnet user-secrets set "ACCELERGREAT:SqlServerEntityFramework:ResetStrategy" "Transactions"

🎨 Complete Example

Here's a full example showing Accelergreat's power:

public class ECommerceIntegrationTests : AccelergreatXunitTest
{
    public ECommerceIntegrationTests(IAccelergreatEnvironmentPool environmentPool) : base(environmentPool)
    {
    }

    [Fact]
    public async Task PlaceOrder_ShouldProcessPaymentAndUpdateInventory()
    {
        // Arrange
        var dbContext = GetComponent<ECommerceDatabaseComponent>().DbContextFactory.NewDbContext();
        var httpClient = GetComponent<ECommerceApiComponent>().CreateClient();
        
        // Add test product
        var product = new Product { Name = "Gaming Laptop", Price = 1299.99m, Stock = 10 };
        dbContext.Products.Add(product);
        await dbContext.SaveChangesAsync();

        // Act
        var response = await httpClient.PostAsJsonAsync("/api/orders", new
        {
            ProductId = product.Id,
            Quantity = 2,
            CustomerEmail = "test@example.com"
        });

        // Assert
        response.Should().BeSuccessful();
        
        var order = await response.Content.ReadFromJsonAsync<Order>();
        order.Should().NotBeNull();
        order.Total.Should().Be(2599.98m);
        
        // Verify database changes
        var updatedProduct = await dbContext.Products.FindAsync(product.Id);
        updatedProduct.Stock.Should().Be(8);  // Stock decreased
        
        var savedOrder = await dbContext.Orders.FindAsync(order.Id);
        savedOrder.Should().NotBeNull();
        savedOrder.Status.Should().Be(OrderStatus.Processing);
    }
}

public class Startup : IAccelergreatStartup
{
    public void Configure(IAccelergreatBuilder builder)
    {
        builder.AddAccelergreatComponent<ECommerceDatabaseComponent>();
        builder.AddAccelergreatComponent<ECommerceApiComponent>();
    }
}

🚀 Migration Guide

From Traditional Integration Tests

// Before: Manual Entity Framework setup/teardown
public class OrderTests : IClassFixture<DatabaseFixture>
{
    private readonly DatabaseFixture _fixture;
    
    public OrderTests(DatabaseFixture fixture)
    {
        _fixture = fixture;
    }
    
    [Fact]
    public async Task Test()
    {
        using var dbContext = _fixture.CreateDbContext();
        
        // Manual cleanup before test
        dbContext.Orders.RemoveRange(dbContext.Orders);
        dbContext.Products.RemoveRange(dbContext.Products);
        await dbContext.SaveChangesAsync();
        
        // Test code
        var product = new Product { Name = "Test" };
        dbContext.Products.Add(product);
        await dbContext.SaveChangesAsync();
        
        // Manual cleanup after test (or risk affecting other tests)
        dbContext.Orders.RemoveRange(dbContext.Orders);
        dbContext.Products.RemoveRange(dbContext.Products);
        await dbContext.SaveChangesAsync();
    }
}

// After: Accelergreat handles everything
[Fact]
public async Task Test()
{
    var dbContext = GetComponent<TestDatabaseComponent>().DbContextFactory.NewDbContext();
    
    // Test code - database auto-resets between tests!
    var product = new Product { Name = "Test" };
    dbContext.Products.Add(product);
    await dbContext.SaveChangesAsync();
    
    // No cleanup needed - next test gets fresh database
}

From WebApplicationFactory

// Before: Manual WebApplicationFactory
public class ApiTests : IClassFixture<WebApplicationFactory<Program>>
{
    private readonly WebApplicationFactory<Program> _factory;
    
    public ApiTests(WebApplicationFactory<Program> factory)
    {
        _factory = factory;
    }
}

// After: Accelergreat component
public class ApiTests : AccelergreatXunitTest
{
    public ApiTests(IAccelergreatEnvironmentPool environmentPool) : base(environmentPool)
    {
    }
    
    [Fact]
    public async Task Test()
    {
        var client = GetComponent<ApiComponent>().CreateClient();
        // Test with auto-configured database!
    }
}

🎯 Best Practices

1. Component Order Matters

public void Configure(IAccelergreatBuilder builder)
{
    builder.AddAccelergreatComponent<DatabaseComponent>();  // First
    builder.AddAccelergreatComponent<ApiComponent>();       // Second (depends on DB)
}

2. Use Environment-Specific Configuration

// Development: Fast transactions
// CI: Reliable snapshots

3. Configure Parallel Execution

// xunit.runner.json
{
  "maxParallelThreads": 4,
  "parallelizeTestCollections": true
}
// Tests automatically run in parallel - no collections needed!
public class OrderCreationTests : AccelergreatXunitTest { }
public class OrderUpdateTests : AccelergreatXunitTest { }
public class ProductTests : AccelergreatXunitTest { }

// Optional: Use collections only for logical grouping
[Collection("SlowTests")]
public class LongRunningTests : AccelergreatXunitTest { }

4. Debugging Tips

// ⚠️ Important: In Visual Studio, don't click "Stop" during debugging
// Let tests complete naturally for proper cleanup


📚 Resources

Documentation

Examples

Community


📄 License

Accelergreat is completely free to use - No licensing fees, no restrictions, all features included.

All Features Available:

  • Transaction reset strategy
  • Microservices support
  • Database providers
  • Parallel execution
  • Environment pooling

📝 Documentation Notice: This documentation has been generated using Cursor AI to improve clarity and developer experience. While every effort has been made to proofread and ensure accuracy, if you encounter any issues or inaccuracies, please contact us at mail@accelergreat.net.

Made with ❤️ by developers, for developers. Transform your integration testing experience with Accelergreat 4.0.

Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 is compatible.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (4)

Showing the top 4 NuGet packages that depend on Accelergreat.EntityFramework:

Package Downloads
Accelergreat.EntityFramework.PostgreSql

Accelergreat PostgreSql (Npsql) Entity Framework testing tools. Accelergreat is an integration testing package that helps to simplify and speed up the writing of integration tests, as well as taking away the challenging task of managing external dependencies.

Accelergreat.EntityFramework.SqlServer

Accelergreat Sql Server Entity Framework testing tools. Accelergreat is an integration testing package that helps to simplify and speed up the writing of integration tests, as well as taking away the challenging task of managing external dependencies.

Accelergreat.EntityFramework.InMemory

Accelergreat In-Memory Entity Framework testing tools. Accelergreat is an integration testing package that helps to simplify and speed up the writing of integration tests, as well as taking away the challenging task of managing external dependencies.

Accelergreat.EntityFramework.Sqlite

Accelergreat Sqlite Entity Framework testing tools. Accelergreat is an integration testing package that helps to simplify and speed up the writing of integration tests, as well as taking away the challenging task of managing external dependencies.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
4.0.2 138 7/16/2025
4.0.1 141 7/15/2025
4.0.0 173 6/16/2025
4.0.0-alpha.c246138 112 7/15/2025
4.0.0-alpha.8c58a78 117 7/15/2025
3.1.1-beta 567 11/6/2024
3.1.0-beta 105 11/6/2024
3.0.0 2,509 7/13/2024
3.0.0-beta.2 658 2/12/2024
3.0.0-beta.1 90 2/9/2024
2.3.0-beta 709 1/23/2024
2.2.7 3,369 9/1/2023
2.2.6-beta 376 9/1/2023
2.2.5-beta 368 9/1/2023
2.2.4 441 9/1/2023
2.2.3-beta 1,201 3/26/2023
2.2.2-beta 476 3/26/2023
2.2.1-beta 466 3/25/2023
2.2.0-beta 460 3/25/2023
2.1.0-beta 440 3/24/2023
2.0.0 4,395 3/8/2023
2.0.0-beta02 474 3/1/2023
2.0.0-beta01 492 2/1/2023
1.7.2-beta 667 10/21/2022
1.7.1 3,253 10/18/2022
1.7.0 1,550 10/18/2022
1.7.0-beta 644 8/28/2022
1.6.4 1,913 8/27/2022
1.6.3-beta 1,430 8/14/2022
1.6.1-beta 740 8/12/2022
1.6.0-beta 632 7/18/2022
1.5.6-beta 789 7/4/2022
1.5.4-beta 725 6/25/2022
1.5.3-beta 635 6/24/2022
1.5.2-beta 656 6/23/2022
1.5.1-beta 625 6/20/2022
1.5.0-beta 622 6/20/2022
1.4.6 15,442 6/8/2022
1.4.5-beta 651 5/30/2022
1.4.4-beta 616 4/24/2022
1.4.3-beta 663 4/23/2022
1.4.2 4,384 3/15/2022
1.4.1-beta 775 3/2/2022
1.4.0-beta 653 2/17/2022
1.3.6 1,991 1/30/2022
1.3.5 1,818 1/30/2022
1.3.2-beta 676 1/27/2022
1.3.1-alpha 677 1/25/2022
1.3.0-alpha 684 1/25/2022
1.2.0 1,813 1/23/2022