Xcepto.Internal.Http 10.4.2

dotnet add package Xcepto.Internal.Http --version 10.4.2
                    
NuGet\Install-Package Xcepto.Internal.Http -Version 10.4.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="Xcepto.Internal.Http" Version="10.4.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Xcepto.Internal.Http" Version="10.4.2" />
                    
Directory.Packages.props
<PackageReference Include="Xcepto.Internal.Http" />
                    
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 Xcepto.Internal.Http --version 10.4.2
                    
#r "nuget: Xcepto.Internal.Http, 10.4.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 Xcepto.Internal.Http@10.4.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=Xcepto.Internal.Http&version=10.4.2
                    
Install as a Cake Addin
#tool nuget:?package=Xcepto.Internal.Http&version=10.4.2
                    
Install as a Cake Tool

Xcepto.NET

test pipeline codecov semantic-release: conventional-commits dotnet: netstandard2.0

Xcepto is a declarative system-test framework for distributed systems that replaces manual retries, sleeping and exception handling with a state-machine-based execution model, aligned with Given-When-Then semantics.

Why Xcepto?

Traditional system tests rely on implicit timing assumptions that lead to non-deterministic results. Artificial workarounds include retries and gates.

This becomes especially problematic in distributed systems, where events are asynchronous and ordering is not guaranteed. Forcing determinism with ad-hoc workarounds pollutes behavior specification into an unmaintainable mess.

Xcepto eliminates these issues by executing tests as condition-driven state machines, removing the need for timing assumptions entirely — making it a natural fit for systems built on asynchronous messaging as well as synchronous request-response interactions.

Mental model

Test steps are not executed immediately when called! They are compiled into a state machine, where transition depends on the specified conditions.

The states are linked in a chain:

graph LR
    Start --> First --> Second --> Third --> Final

The test passes, if the Final state was reached before a timeout.

Getting Started

dotnet add package Xcepto

Given

Xcepto.Given introduces a specification environment based on a scenario.

var scenario = new YourScenario();
await XceptoTest.Given(scenario, builder =>
{
    // Declare test behaviour here
}

Scenario classes specify instructions to setup and prepare the system under test.

This snippet is runnable by itself.

The next step is to specify test behavior using Adapters.

Adapters

Raw Xcepto itself is just a runtime and lifecycle manager for tests. Adapters actually integrate technologies into the Xcepto ecosystem.

SSR and REST have HTTP as interfacing boundary making them ideal targets for official adapters.

Here are some examples:

Server Side Rendering (SSR)

await XceptoTest.Given(scenario, builder =>
{
    var ssr = builder.SsrAdapterBuilder()
        .WithBaseUrl(new Uri($"http://localhost:{scenario.GuiPort}"))
        .Build();

    ssr.Post("/auth/register")
        .WithFormContent(new RegisterRequest(username, password).ToForm())
        .AssertSuccess()
        .AssertThatResponseContentString(Does.Not.Contain("id=\"errors\""));
    
    ssr.Post("/auth/login")
        .WithFormContent(new LoginRequest(username, password).ToForm())
        .AssertSuccess()
        .AssertThatResponseContentString(Does.Not.Contain("id=\"errors\""));

    ssr.Get("/")
        .AssertThatResponseContentString(Does.Contain(username));
});

Combined REST & SSR

await XceptoTest.Given(scenario, builder =>
{
    var ssr = builder.SsrAdapterBuilder()
        .WithBaseUrl(scenario.GuiAddress)
        .Build();

    var rest = builder.RestAdapterBuilder()
        .WithBaseUrl(scenario.ApiAddress)
        .Build();
                
    var tokenResponse = ssr.Post($"/token/create")
        .WithFormContent(new ProjectTokenCreateRequest("new token").ToForm())
        .AssertSuccess()
        .PromiseResponse();        
    
    rest.Post($"/api/env/create")
        .WithBearerTokenClient(() => ExtractToken(tokenResponse.Resolve()))
        .AssertSuccess();
});

Custom adapters

Predefined adapters cover common cases. For complex systems (e.g. message-driven architectures like RabbitMQ and Kafka), custom adapters provide far more flexibility and control.

<details> <summary><strong>Advanced: Build your own adapter</strong></summary>

Here is an example from my HiveShard project. The adapter integrates client compartments of the system and enables executing actions and setting exceptions on its behalf.

public class HiveShardClientAdapter: XceptoAdapter
{
    private readonly CompartmentIdentifier _compartmentIdentifier;

    public HiveShardClientAdapter(HiveShardClient client)
    {
        _compartmentIdentifier = new CompartmentIdentifier(client.UserId, CompartmentType.Client);
    }

    public void Action(Func<IClientTunnel, Task> clientAction)
    {
        AddStep(new CompartmentalizedServiceBasedActionState<IClientTunnel>("Client Action", _compartmentIdentifier, clientAction)); 
    }

    public void Expect<T>(Predicate<T> expectation)
        where T: IEvent
    {
        AddStep(new CompartmentalizedClientExpectationState<T>($"Client Expectation of {typeof(T)}", _compartmentIdentifier, expectation));
    }
}

The states also need to be defined. They represent a lazy action or expectation. They are only executed once this state has been reached in the chain.

public class CompartmentalizedServiceBasedActionState<T>: XceptoState
    where T: class
{
    private readonly Func<T, Task> _action;
    private readonly CompartmentIdentifier _compartmentIdentifier;

    public CompartmentalizedServiceBasedActionState(string name, 
        CompartmentIdentifier compartmentIdentifier, Func<T, Task> action) : base(name)
    {
        _compartmentIdentifier = compartmentIdentifier;
        this._action = action;
    }

    // always transition
    public override Task<bool> EvaluateConditionsForTransition(IServiceProvider serviceProvider)
        => Task.FromResult(true);

    // execute on enter
    public override async Task OnEnter(IServiceProvider serviceProvider)
    {
        // query identified service
        var compartmentRepository = serviceProvider.GetRequiredService<CompartmentRepository>();
        var compartment = compartmentRepository.GetCompartment(_compartmentIdentifier.ToString());
        var service = compartment.Services.GetRequiredService<T>();
        
        // execute action on that service
        await _action(service);
    }
}

The adapter can now be utilized in Xcepto tests:

await XceptoTest.Given(environment, builder =>
{
    var client = builder.RegisterAdapter(new HiveShardClientAdapter(credentials));
    Uri? connectedEdge = null;

    client.Action(x => x.Connect(credentials));
    client.Expect<ConnectionSucceeded>(x =>
    {
        connectedEdge = x.Edge;
        return true;
    });
    client.Action(x=> x.SendHotPathEvent(new EdgeBindingRequest(credentials)));
    client.Expect<EdgeBoundNotification>(x => x.Uri.Equals(connectedEdge));
});

All of this can be refined with fluentApis. The official SSR and REST adapters showcase this principle.

</details>

Execution Models

Both async and enumerated execution models are supported. The reason for async support is obvious for distributed systems.

Enumerated, on the other hand, supports execution flows in video games with game engines like Unity, as those allow Xcepto users to space execution apart over multiple frames. This also enables integrating waiting for gameplay events.

Here is an example UnityTest:

[UnityTest]
public IEnumerator NonBlockingRuntimeTest()
{
    yield return XceptoTest.GivenEnumerated(new ExampleScenario(), builder =>
    {
        var ssr = builder.SsrAdapterBuilder()
            .WithBaseUrl(new Uri("https://xcepto.org"))
            .Build();
    
        ssr.Post("/auth/login")
            .WithFormContent(new LoginRequest(username, password).ToForm())
            .AssertSuccess();
    
        ssr.Get("/")
            .AssertThatResponseContentString(Does.Contain(username));
    });
}

Compartments

Xcepto also boasts a full InMemory isolation system called Compartments. This enables hosting multiple systems inMemory that can communicate each other via explicitly defined interfaces. Compartmentalized services are still fully addressable in states via compartment identifiers.

Compartment.From(new ServiceCollection()
    .AddSingleton<Service1>()
    .AddSingleton<PersonalDependency>() // individual instance
)
.ExposeService<Service1>() // shared instance
.Identify("service1")
.Build();

Compartment.From(new ServiceCollection()
    .AddSingleton<Service2>()
    .AddSingleton<PersonalDependency>() // individual instance
)
.DependsOn<Service1>() // consume shared instance
.Identify("service2")
.Build();

Identification in states works like this:

public override async Task OnEnter(IServiceProvider serviceProvider)
{
    // query identified service
    var compartmentRepository = serviceProvider.GetRequiredService<CompartmentRepository>();
    var compartment = compartmentRepository.GetCompartment(_compartmentIdentifier.ToString());
    var service = compartment.Services.GetRequiredService<T>();
    
    // do something with service
}

Resilience Guarantees

Xcepto is heavily tested in regards to resilience. It bolsters > 140 test cases, each targeting a set of options. Xcepto heavily employs matrix tests to cover every possibility.

Here is a summary of guaranteed properties:

  • Cleanup execution always happens
  • Compartments are truly isolated
  • Async and Enumerated execution models cause identical results
  • Exceptions always short-circuit failure and yield specific error details
  • Concurrent non-blocking subsystem failures are propagated properly
  • The supplied ILoggingProvider is always flushed, even on exception
  • Transitions are retried until timeout according to specification
  • Timeouts always happen! No blocking behaviour can stop this

Apart from that, correctness checks for official adapters are also in place.

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 was computed.  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 was computed.  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 was computed.  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 (2)

Showing the top 2 NuGet packages that depend on Xcepto.Internal.Http:

Package Downloads
Xcepto.Rest

REST adapter for Xcepto testing library

Xcepto.SSR

SSR adapter for Xcepto testing library

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
10.4.2 153 4/8/2026
10.4.1 165 2/28/2026
10.4.0 203 2/20/2026
10.3.0 176 2/14/2026
10.2.0 158 2/13/2026
10.1.0 156 2/13/2026
10.0.3 254 2/12/2026