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
83 changes: 41 additions & 42 deletions Shared.EventStore.Tests/DomainEventHelperTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,56 +4,56 @@
using System.Text;
using System.Threading.Tasks;

namespace Shared.Tests
{
using DomainDrivenDesign.EventSourcing;
using EventStore.Tests;
using Shared.EventStore.Tests.TestObjects;
using Shouldly;
using Xunit;
namespace Shared.Tests;

using DomainDrivenDesign.EventSourcing;
using EventStore.Tests;
using Shared.EventStore.Tests.TestObjects;
using Shouldly;
using Xunit;

public class DomainEventHelperTests
public class DomainEventHelperTests
{
[Fact]
public void DomainEventHelper_GetProperty_CorrectCase_PropertyNotFound()
{
[Fact]
public void DomainEventHelper_GetProperty_CorrectCase_PropertyNotFound()
{

AggregateNameSetEvent domainEvent = new(TestData.AggregateId, TestData.EventId, TestData.EstateName);
String propertyValue = DomainEventHelper.GetProperty<String>(domainEvent, "AggregateName1");
propertyValue.ShouldBe(default);
}
AggregateNameSetEvent domainEvent = new(TestData.AggregateId, TestData.EventId, TestData.EstateName);
String propertyValue = DomainEventHelper.GetProperty<String>(domainEvent, "AggregateName1");
propertyValue.ShouldBe(default);
}

[Theory]
[InlineData("AggregateName1")]
[InlineData("aggregatename1")]
[InlineData("AGGREGATENAME1")]
public void DomainEventHelper_GetProperty_IgnoreCase_PropertyNotFound(String propertyName)
{
[Theory]
[InlineData("AggregateName1")]
[InlineData("aggregatename1")]
[InlineData("AGGREGATENAME1")]
public void DomainEventHelper_GetProperty_IgnoreCase_PropertyNotFound(String propertyName)
{

AggregateNameSetEvent domainEvent = new(TestData.AggregateId, TestData.EventId, TestData.EstateName);
String propertyValue = DomainEventHelper.GetProperty<String>(domainEvent, propertyName, true);
propertyValue.ShouldBe(default);
}
AggregateNameSetEvent domainEvent = new(TestData.AggregateId, TestData.EventId, TestData.EstateName);
String propertyValue = DomainEventHelper.GetProperty<String>(domainEvent, propertyName, true);
propertyValue.ShouldBe(default);
}

[Fact]
public void DomainEventHelper_GetProperty_CorrectCase_PropertyFound(){
[Fact]
public void DomainEventHelper_GetProperty_CorrectCase_PropertyFound(){

AggregateNameSetEvent domainEvent = new(TestData.AggregateId, TestData.EventId, TestData.EstateName);
String propertyValue = DomainEventHelper.GetProperty<String>(domainEvent, "AggregateName");
propertyValue.ShouldBe(TestData.EstateName);
}
AggregateNameSetEvent domainEvent = new(TestData.AggregateId, TestData.EventId, TestData.EstateName);
String propertyValue = DomainEventHelper.GetProperty<String>(domainEvent, "AggregateName");
propertyValue.ShouldBe(TestData.EstateName);
}

[Theory]
[InlineData("AggregateName")]
[InlineData("aggregatename")]
[InlineData("AGGREGATENAME")]
public void DomainEventHelper_GetProperty_IgnoreCase_PropertyFound(String propertyName)
{
[Theory]
[InlineData("AggregateName")]
[InlineData("aggregatename")]
[InlineData("AGGREGATENAME")]
public void DomainEventHelper_GetProperty_IgnoreCase_PropertyFound(String propertyName)
{

AggregateNameSetEvent domainEvent = new(TestData.AggregateId, TestData.EventId, TestData.EstateName);
String propertyValue = DomainEventHelper.GetProperty<String>(domainEvent, propertyName, true);
propertyValue.ShouldBe(TestData.EstateName);
}
AggregateNameSetEvent domainEvent = new(TestData.AggregateId, TestData.EventId, TestData.EstateName);
String propertyValue = DomainEventHelper.GetProperty<String>(domainEvent, propertyName, true);
propertyValue.ShouldBe(TestData.EstateName);
}

[Theory]
[InlineData("AggregateName", true)]
Expand All @@ -69,4 +69,3 @@ public void DomainEventHelper_HasProperty_ExpectedResultReturned(String property
}

}
}
45 changes: 22 additions & 23 deletions Shared.EventStore.Tests/SubscriptionRepositoryTests.cs
Original file line number Diff line number Diff line change
@@ -1,33 +1,32 @@
using Shared.EventStore.Tests.TestObjects;

namespace Shared.EventStore.Tests
{
using System;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using Shouldly;
using SubscriptionWorker;
using Xunit;

public class SubscriptionRepositoryTests
{
#region Methods
namespace Shared.EventStore.Tests;

using System;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using Shouldly;
using SubscriptionWorker;
using Xunit;

[Fact]
public async Task SubscriptionRepository_GetSubscriptions_ReturnsSubscriptions()
{
List<PersistentSubscriptionInfo> allSubscriptions = (TestData.GetPersistentSubscriptions_DemoEstate());
public class SubscriptionRepositoryTests
{
#region Methods

Func<CancellationToken, Task<List<PersistentSubscriptionInfo>>> GetAllSubscriptions = async token => allSubscriptions;
[Fact]
public async Task SubscriptionRepository_GetSubscriptions_ReturnsSubscriptions()
{
List<PersistentSubscriptionInfo> allSubscriptions = (TestData.GetPersistentSubscriptions_DemoEstate());

ISubscriptionRepository subscriptionRepository = SubscriptionRepository.Create(GetAllSubscriptions);
Func<CancellationToken, Task<List<PersistentSubscriptionInfo>>> GetAllSubscriptions = async token => allSubscriptions;

Check warning on line 22 in Shared.EventStore.Tests/SubscriptionRepositoryTests.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 22 in Shared.EventStore.Tests/SubscriptionRepositoryTests.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.

PersistentSubscriptions list = await subscriptionRepository.GetSubscriptions(true, CancellationToken.None);
ISubscriptionRepository subscriptionRepository = SubscriptionRepository.Create(GetAllSubscriptions);

list.PersistentSubscriptionInfo.Count.ShouldBe(allSubscriptions.Count);
}
PersistentSubscriptions list = await subscriptionRepository.GetSubscriptions(true, CancellationToken.None);

#endregion
list.PersistentSubscriptionInfo.Count.ShouldBe(allSubscriptions.Count);
}

#endregion
}
Loading