Skip to content

Commit

Permalink
test: Cover Neo4j and Cosmos DB database and password configuration p…
Browse files Browse the repository at this point in the history
…roperties
  • Loading branch information
HofmeisterAn committed Oct 19, 2022
1 parent 80f78d8 commit aba9f75
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ private AllServicesEnabled(AzuriteFixture.AzuriteWithCustomContainerPortsFixture
}

[Fact]
public async Task ShouldEstablishServiceConnection()
public async Task ConnectionEstablished()
{
var exception = await Record.ExceptionAsync(() => Task.WhenAll(EstablishConnection(this.commonContainerPorts), EstablishConnection(this.customContainerPorts)))
.ConfigureAwait(false);
Expand Down Expand Up @@ -131,7 +131,7 @@ public BlobServiceEnabled(AzuriteFixture.AzuriteWithBlobOnlyFixture azurite)
}

[Fact]
public async Task ShouldEstablishServiceConnection()
public async Task ConnectionEstablished()
{
// Given
var blobServiceClient = new BlobServiceClient(this.azurite.Container.ConnectionString);
Expand Down Expand Up @@ -174,7 +174,7 @@ public QueueServiceEnabled(AzuriteFixture.AzuriteWithQueueOnlyFixture azurite)
}

[Fact]
public async Task ShouldEstablishServiceConnection()
public async Task ConnectionEstablished()
{
// Given
var blobServiceClient = new BlobServiceClient(this.azurite.Container.ConnectionString);
Expand Down Expand Up @@ -217,7 +217,7 @@ public TableServiceEnabled(AzuriteFixture.AzuriteWithTableOnlyFixture azurite)
}

[Fact]
public async Task ShouldEstablishServiceConnection()
public async Task ConnectionEstablished()
{
// Given
var blobServiceClient = new BlobServiceClient(this.azurite.Container.ConnectionString);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ namespace DotNet.Testcontainers.Tests.Unit
using System.Net;
using System.Net.Http;
using System.Threading.Tasks;
using DotNet.Testcontainers.Configurations;
using DotNet.Testcontainers.Tests.Fixtures;
using Microsoft.Azure.Cosmos;
using Xunit;
Expand Down Expand Up @@ -37,7 +38,7 @@ private ConnectionTests(HttpClient httpClient, string connectionString)
#pragma warning disable xUnit1004

[Fact(Skip = SkipReason)]
public async Task ShouldEstablishConnection()
public async Task ConnectionEstablished()
{
var accountProperties = await this.cosmosClient.ReadAccountAsync()
.ConfigureAwait(false);
Expand All @@ -54,6 +55,13 @@ public async Task CreateDatabaseTest()
Assert.Equal(HttpStatusCode.Created, databaseResponse.StatusCode);
}

[Fact(Skip = SkipReason)]
public void CannotSetPassword()
{
var cosmosDb = new CosmosDbTestcontainerConfiguration();
Assert.Throws<NotImplementedException>(() => cosmosDb.Password = string.Empty);
}

#pragma warning restore xUnit1004

public void Dispose()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
namespace DotNet.Testcontainers.Tests.Unit
{
using System;
using System.Threading.Tasks;
using DotNet.Testcontainers.Configurations;
using DotNet.Testcontainers.Tests.Fixtures;
using Xunit;

Expand All @@ -22,5 +24,19 @@ public async Task ConnectionEstablished()

Assert.Null(exception);
}

[Fact]
public void CannotSetDatabase()
{
var neo4j = new Neo4jTestcontainerConfiguration();
Assert.Throws<NotImplementedException>(() => neo4j.Database = string.Empty);
}

[Fact]
public void CannotSetUsername()
{
var neo4j = new Neo4jTestcontainerConfiguration();
Assert.Throws<NotImplementedException>(() => neo4j.Username = string.Empty);
}
}
}

0 comments on commit aba9f75

Please sign in to comment.