public async Task RemoveAsync(string id, CancellationToken ct = default) { if (await DockerApiClientContainer.Instance.ExistsWithIdAsync(id)) { await Docker.Containers.RemoveContainerAsync(id, new ContainerRemoveParameters { Force = true, RemoveVolumes = true }, ct); } TestcontainersRegistryService.Unregister(id); }
public void RemoveTestcontainer() { // Given const string id = nameof(this.RemoveTestcontainer); // When TestcontainersRegistryService.Register(id, true); TestcontainersRegistryService.Unregister(id); // Then Assert.DoesNotContain(id, TestcontainersRegistryService.GetRegisteredContainers()); }