Skip to content

Andrei15193/CloudStub.AzureDataTables

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

150 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

A high-fidelity in-memory implementation for Azure Table Storage useful for testing and local development.

Setup

The library provides a complete in-memory implementation for both the table service client and table clients. Replacing the table service client is enough to have have all subsequent table clients replaced with stubs as well.

public class DataTables
{
    public DataTables(TableServiceClient tableServiceClient)
    {
        Users = tableServiceClient.GetTableClient("Users");
    }

    public TableClient Users { get; }
}

public class MyTestClass
{
    public void MyTestMethod()
    {
        var dataTables = new DataTables(new TableServiceClientStub());

        dataTables.Users.Query<TableEntity>();
    }
}

Similar setups can be made for integration tests or local development.

public class MyWebApplicationFactory : WebApplicationFactory<Startup>
{
    protected override void ConfigureWebHost(IWebHostBuilder builder)
        => builder.ConfigureTestServices(services =>
        {
            services.AddSingleton<TableServiceClient>(_ => new TableServiceClientStub());
        });
}

About

A high-fidelity in-memory implementation of Azure Cloud Storage Services useful for testing.

Topics

Resources

License

Stars

Watchers

Forks

Contributors

Languages