Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions Shared.EventStore.Tests/AggregateRepositoryTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -147,11 +147,6 @@ public async Task AggregateRepository_GetLatestVersionFromLastEvent_GetEventsFai

AggregateRepository<TestAggregate, DomainEvent> testAggregateRepository = new(context.Object, factory);

AggregateNameSetEvent aggregateNameSetEvent = new(TestData.AggregateId, TestData.EventId, "Test");
EventRecord r = TestData.CreateEventRecord<AggregateNameSetEvent>(aggregateNameSetEvent, "TestAggregate");
List<ResolvedEvent> e = new(){
new ResolvedEvent(r, null, null)
};
context.Setup(c => c.GetEventsBackward(It.IsAny<String>(), It.IsAny<Int32>(), It.IsAny<CancellationToken>())).ReturnsAsync(Result.Failure("error"));

Result<TestAggregate> result = await testAggregateRepository.GetLatestVersionFromLastEvent(TestData.AggregateId, CancellationToken.None);
Expand Down
6 changes: 0 additions & 6 deletions Shared.EventStore.Tests/AggregateServiceTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ public async Task Get_ShouldReturnAggregateFromRepository_WhenNotInCache_AndSetT
public async Task Get_ShouldReturnAggregateFromRepository_GetLatestFails_FailedResultReturned() {
// Arrange
var aggregateId = Guid.NewGuid();
var aggregate = new TestAggregate { AggregateId = aggregateId };
var repositoryMock = new Mock<IAggregateRepository<TestAggregate, DomainEvent>>();

repositoryMock.Setup(repo => repo.GetLatestVersion(aggregateId, It.IsAny<CancellationToken>())).ReturnsAsync(Result.Failure("Error getting latest"));
Expand All @@ -106,7 +105,6 @@ public async Task Get_ShouldReturnAggregateFromRepository_GetLatestFails_FailedR
public async Task Get_ShouldReturnAggregateFromRepository_GetLatestThrowsException_FailedResultReturned() {
// Arrange
var aggregateId = Guid.NewGuid();
var aggregate = new TestAggregate { AggregateId = aggregateId };
var repositoryMock = new Mock<IAggregateRepository<TestAggregate, DomainEvent>>();

repositoryMock.Setup(repo => repo.GetLatestVersion(aggregateId, It.IsAny<CancellationToken>())).ThrowsAsync(new Exception("Exception Message"));
Expand Down Expand Up @@ -228,7 +226,6 @@ public async Task GetLatest_ShouldReturnAggregateDataStore() {
public async Task GetLatest_GetFailed_ReturnsFailedResult() {
// Arrange
var aggregateId = Guid.NewGuid();
var aggregate = new TestAggregate { AggregateId = aggregateId };
var repositoryMock = new Mock<IAggregateRepository<TestAggregate, DomainEvent>>();

_repositoryResolverMock.Setup(resolver => resolver.Resolve<TestAggregate, DomainEvent>()).Returns(repositoryMock.Object);
Expand All @@ -246,7 +243,6 @@ public async Task GetLatest_GetFailed_ReturnsFailedResult() {
public async Task GetLatest_GetLatestThrowsException_ReturnsFailedResult() {
// Arrange
var aggregateId = Guid.NewGuid();
var aggregate = new TestAggregate { AggregateId = aggregateId };
var repositoryMock = new Mock<IAggregateRepository<TestAggregate, DomainEvent>>();

_repositoryResolverMock.Setup(resolver => resolver.Resolve<TestAggregate, DomainEvent>()).Returns(repositoryMock.Object);
Expand Down Expand Up @@ -282,7 +278,6 @@ public async Task GetLatestVersionFromLastEvent_ShouldReturnAggregateDataStore()
public async Task GetLatestVersionFromLastEvent_GetFailed_ReturnsFailedResult() {
// Arrange
var aggregateId = Guid.NewGuid();
var aggregate = new TestAggregate { AggregateId = aggregateId };
var repositoryMock = new Mock<IAggregateRepository<TestAggregate, DomainEvent>>();

_repositoryResolverMock.Setup(resolver => resolver.Resolve<TestAggregate, DomainEvent>()).Returns(repositoryMock.Object);
Expand All @@ -300,7 +295,6 @@ public async Task GetLatestVersionFromLastEvent_GetFailed_ReturnsFailedResult()
public async Task GetLatestVersionFromLastEvent_GetLatestThrowsException_ReturnsFailedResult() {
// Arrange
var aggregateId = Guid.NewGuid();
var aggregate = new TestAggregate { AggregateId = aggregateId };
var repositoryMock = new Mock<IAggregateRepository<TestAggregate, DomainEvent>>();

_repositoryResolverMock.Setup(resolver => resolver.Resolve<TestAggregate, DomainEvent>()).Returns(repositoryMock.Object);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ public async Task EventStoreConnectionStringHealthCheck_CheckHealthAsync_EventsR
public async Task EventStoreConnectionStringHealthCheck_CheckHealthAsync_NoEventsReturned_Unhealthy()
{
Mock<IEventStoreContext> context = new();
AggregateNameSetEvent aggregateNameSetEvent = new(TestData.AggregateId, TestData.EventId, "Test");

context.Setup(c => c.ReadLastEventsFromAll(It.IsAny<long>(), It.IsAny<CancellationToken>())).ReturnsAsync(Result.Success(new List<ResolvedEvent>()));
EventStoreConnectionStringHealthCheck healthCheck = new(context.Object);
Expand All @@ -58,7 +57,6 @@ public async Task EventStoreConnectionStringHealthCheck_CheckHealthAsync_NoEvent
public async Task EventStoreConnectionStringHealthCheck_CheckHealthAsync_ReadLastEventsFromAll_Unhealthy()
{
Mock<IEventStoreContext> context = new();
AggregateNameSetEvent aggregateNameSetEvent = new(TestData.AggregateId, TestData.EventId, "Test");

context.Setup(c => c.ReadLastEventsFromAll(It.IsAny<long>(), It.IsAny<CancellationToken>())).ReturnsAsync(Result.Failure());
EventStoreConnectionStringHealthCheck healthCheck = new(context.Object);
Expand All @@ -70,7 +68,6 @@ public async Task EventStoreConnectionStringHealthCheck_CheckHealthAsync_ReadLas
public async Task EventStoreConnectionStringHealthCheck_CheckHealthAsync_ExceptionThrown_Unhealthy()
{
Mock<IEventStoreContext> context = new();
AggregateNameSetEvent aggregateNameSetEvent = new(TestData.AggregateId, TestData.EventId, "Test");

context.Setup(c => c.ReadLastEventsFromAll(It.IsAny<long>(), It.IsAny<CancellationToken>())).ThrowsAsync(new Exception());
EventStoreConnectionStringHealthCheck healthCheck = new(context.Object);
Expand Down
2 changes: 0 additions & 2 deletions Shared.EventStore/EventStore/EventStoreContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -233,8 +233,6 @@ public async Task<Result<String>> RunTransientQuery(String query, CancellationTo
{
await this.ProjectionManagementClient.CreateTransientAsync(queryName, query, cancellationToken: source.Token);

Stopwatch stopwatch = Stopwatch.StartNew();

while (true)
{
if (cancellationToken.IsCancellationRequested)
Expand Down
1 change: 0 additions & 1 deletion Shared.EventStore/ProjectionEngine/ProjectionHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ public async Task Handle(IDomainEvent @event, CancellationToken cancellationToke
}

Stopwatch stopwatch = Stopwatch.StartNew();
StringBuilder builder = new();

//Load the state from persistence
TState state = await this.ProjectionStateRepository.Load(@event, cancellationToken);
Expand Down
4 changes: 0 additions & 4 deletions Shared.EventStoreContext.Tests/EventStoreContextTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,7 @@
}

[OneTimeTearDown]
public async Task TearDown(){

Check warning on line 45 in Shared.EventStoreContext.Tests/EventStoreContextTests.cs

View workflow job for this annotation

GitHub Actions / Build and Test Pull Requests - Linux

This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread.

Check warning on line 45 in Shared.EventStoreContext.Tests/EventStoreContextTests.cs

View workflow job for this annotation

GitHub Actions / Build and Test Pull Requests - Windows

This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread.
DockerServices sharedDockerServices = DockerServices.SqlServer;

//await this.EventStoreDockerHelper.StopContainersForScenarioRun(sharedDockerServices);
}

Expand Down Expand Up @@ -91,7 +89,7 @@

[Test]
public void EventStoreContext_GetStatusFrom_ProjectionDetailsIsNull_CorrectValueReturned(){
ProjectionDetails projectionDetails = null;

Check warning on line 92 in Shared.EventStoreContext.Tests/EventStoreContextTests.cs

View workflow job for this annotation

GitHub Actions / Build and Test Pull Requests - Linux

Converting null literal or possible null value to non-nullable type.

Check warning on line 92 in Shared.EventStoreContext.Tests/EventStoreContextTests.cs

View workflow job for this annotation

GitHub Actions / Build and Test Pull Requests - Windows

Converting null literal or possible null value to non-nullable type.
ProjectionRunningStatus result = EventStoreContext.GetStatusFrom(projectionDetails);
result.ShouldBe(ProjectionRunningStatus.StatisticsNotFound);
}
Expand Down Expand Up @@ -258,7 +256,6 @@
[TestCase(false)]
public async Task EventStoreContext_RunTransientQuery_QueryIsRun(Boolean secureEventStore){
TimeSpan deadline = TimeSpan.FromMinutes(2);
TimeSpan retryTimeout = TimeSpan.FromMinutes(6);

await this.EventStoreDockerHelper.StartContainers(secureEventStore, $"EventStoreContext_RunTransientQuery_QueryIsRun{secureEventStore}");

Expand Down Expand Up @@ -305,7 +302,6 @@
[TestCase(false)]
public async Task EventStoreContext_RunTransientQuery_ResultIsEmpty_ErrorThrown(Boolean secureEventStore){
TimeSpan deadline = TimeSpan.FromMinutes(2);
TimeSpan retryTimeout = TimeSpan.FromMinutes(6);

await this.EventStoreDockerHelper.StartContainers(secureEventStore, $"EventStoreContext_RunTransientQuery_ResultIsEmpty_ErrorThrown{secureEventStore}");

Expand Down
7 changes: 1 addition & 6 deletions Shared.IntegrationTesting/BaseDockerHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -546,7 +546,7 @@

(String imageName, Boolean useLatest) imageDetails = this.GetImageDetails(ContainerType.TestHost);
ContainerBuilder testHostContainer = new Builder().UseContainer().WithName(this.TestHostContainerName).WithEnvironment(environmentVariables.ToArray())
.UseImageDetails(this.GetImageDetails(ContainerType.TestHost)).ExposePort(DockerPorts.TestHostPort)
.UseImageDetails(imageDetails).ExposePort(DockerPorts.TestHostPort)
.MountHostFolder(this.DockerPlatform, this.HostTraceFolder)
.SetDockerCredentials(this.DockerCredentials);

Expand Down Expand Up @@ -671,7 +671,7 @@
connection.Close();
this.Trace("SQL Server Container Running");
}
catch(SqlException ex){

Check warning on line 674 in Shared.IntegrationTesting/BaseDockerHelper.cs

View workflow job for this annotation

GitHub Actions / Build and Test Pull Requests - Linux

The variable 'ex' is declared but never used

Check warning on line 674 in Shared.IntegrationTesting/BaseDockerHelper.cs

View workflow job for this annotation

GitHub Actions / Build and Test Pull Requests - Windows

The variable 'ex' is declared but never used
if (connection.State == ConnectionState.Open){
connection.Close();
}
Expand Down Expand Up @@ -837,7 +837,6 @@
protected virtual async Task LoadEventStoreProjections(){
//Start our Continuous Projections - we might decide to do this at a different stage, but now lets try here
String projectionsFolder = "projections/continuous";
IPAddress[] ipAddresses = Dns.GetHostAddresses("127.0.0.1");

if (!String.IsNullOrWhiteSpace(projectionsFolder)){
DirectoryInfo di = new(projectionsFolder);
Expand All @@ -860,7 +859,7 @@
try{
await projectionClient.CreateContinuousAsync(projectionName, projection, trackEmittedStreams:true).ConfigureAwait(false);
}
catch(Exception ex){

Check warning on line 862 in Shared.IntegrationTesting/BaseDockerHelper.cs

View workflow job for this annotation

GitHub Actions / Build and Test Pull Requests - Linux

The variable 'ex' is declared but never used

Check warning on line 862 in Shared.IntegrationTesting/BaseDockerHelper.cs

View workflow job for this annotation

GitHub Actions / Build and Test Pull Requests - Windows

The variable 'ex' is declared but never used
}

projectionNames.Add(projectionName);
Expand Down Expand Up @@ -1019,15 +1018,11 @@
return default;
}

var d = BaseDockerHelper.GetDockerHost();


try
{
return await startContainerFunc(networkServices);
}
catch(Exception ex){

this.Error($"Error starting container [{startContainerFunc.Method.Name}]", ex);
throw;
}
Expand Down
1 change: 0 additions & 1 deletion Shared.Tests/ConfigurationReaderTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,6 @@ public void ConfigurationReader_GetValueFromSection_NotInitialised_ErrorThrown()
field.SetValue(null, false);

TestOutputHelper.WriteLine(DateTime.Now.ToString("hh:mm:ss.fff"));
IConfigurationBuilder configurationBuilder = new ConfigurationBuilder().AddInMemoryCollection(TestHelpers.DefaultAppSettings).AddEnvironmentVariables();

Should.Throw<InvalidOperationException>(() => ConfigurationReader.GetValueFromSection<List<String>>("AppSettings", "TestArray"));
}
Expand Down
Loading