Skip to main content

Definition

Assembly: CloudNimble.Breakdance.Azurite.dll Namespace: CloudNimble.Breakdance.Azurite Inheritance: CloudNimble.Breakdance.Assemblies.BreakdanceTestBase

Syntax

CloudNimble.Breakdance.Azurite.AzuriteBreakdanceTestBase

Summary

Base class for tests that require an Azurite instance. Each derived class must declare its own static AzuriteInstance field and override the Azurite property to return it.

Remarks

MSTest requires [ClassInitialize] and [ClassCleanup] to be static methods. To avoid cross-class pollution (static fields on a base class are shared by ALL derived classes), each test class must own its own static instance.

Examples

[TestClass]
public class MyTests : AzuriteTestBase
{
    private static AzuriteInstance _azurite;

    protected override AzuriteInstance Azurite => _azurite;

    [ClassInitialize]
    public static async Task ClassInit(TestContext ctx)
    {
        _azurite = await CreateAndStartInstanceAsync(new AzuriteConfiguration
        {
            Services = AzuriteServiceType.All,
            InMemoryPersistence = true,
            Silent = true
        });
    }

    [ClassCleanup]
    public static async Task ClassCleanup()
    {
        if (_azurite != null)
        {
            await _azurite.DisposeAsync();
            _azurite = null;
        }
    }

    [TestMethod]
    public void MyTest()
    {
        Assert.IsNotNull(BlobEndpoint);
    }
}

Properties

BlobEndpoint

Gets the Blob service endpoint URL.

Syntax

public string BlobEndpoint { get; }

Property Value

Type: string

BlobPort

Gets the Blob service port number, or null if not started.

Syntax

public System.Nullable<int> BlobPort { get; }

Property Value

Type: System.Nullable<int>

ConnectionString

Gets a connection string for the Azurite Development Storage account.

Syntax

public string ConnectionString { get; }

Property Value

Type: string

QueueEndpoint

Gets the Queue service endpoint URL.

Syntax

public string QueueEndpoint { get; }

Property Value

Type: string

QueuePort

Gets the Queue service port number, or null if not started.

Syntax

public System.Nullable<int> QueuePort { get; }

Property Value

Type: System.Nullable<int>

TableEndpoint

Gets the Table service endpoint URL.

Syntax

public string TableEndpoint { get; }

Property Value

Type: string

TablePort

Gets the Table service port number, or null if not started.

Syntax

public System.Nullable<int> TablePort { get; }

Property Value

Type: System.Nullable<int>