Skip to content

Commit 95e0c88

Browse files
author
Anthony Sneed
committed
Update SpecFlow tests.
1 parent 603062d commit 95e0c88

File tree

57 files changed

+1533
-185
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+1533
-185
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -363,3 +363,4 @@ MigrationBackup/
363363
FodyWeavers.xsd
364364
.idea
365365
.DS_Store
366+
**/.tye

reference-architecture/CustomerService/Repositories/CustomerRepository.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ public async Task<IEnumerable<Customer>> GetAsync() =>
2323
{
2424
var existing = await FindOneAsync(e => e.Id == entity.Id);
2525
if (existing != null) return null;
26-
entity.ETag = Guid.NewGuid().ToString();
26+
if (string.IsNullOrWhiteSpace(entity.ETag))
27+
entity.ETag = Guid.NewGuid().ToString();
2728
return await InsertOneAsync(entity);
2829
}
2930

reference-architecture/OrderService/Repositories/OrderRepository.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ public async Task<IEnumerable<Order>> GetByCustomerAsync(Guid customerId) =>
2525
{
2626
var existing = await FindOneAsync(e => e.Id == entity.Id);
2727
if (existing != null) return null;
28-
entity.ETag = Guid.NewGuid().ToString();
28+
if (string.IsNullOrWhiteSpace(entity.ETag))
29+
entity.ETag = Guid.NewGuid().ToString();
2930
return await InsertOneAsync(entity);
3031
}
3132

test/CustomerService.Tests/Controllers/CustomerCommandControllerTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
using CustomerService.Domain.CustomerAggregate;
66
using CustomerService.Domain.CustomerAggregate.Commands;
77
using CustomerService.Tests.Fakes;
8-
using CustomerService.Tests.Utils;
8+
using CustomerService.Tests.Helpers;
99
using EventDriven.DDD.Abstractions.Commands;
1010
using Microsoft.AspNetCore.Mvc;
1111
using Moq;
@@ -21,7 +21,7 @@ public class CustomerCommandControllerTests
2121
public CustomerCommandControllerTests()
2222
{
2323
_commandBrokerMoq = new Mock<ICommandBroker>();
24-
_mapper = BaseUtils.GetMapper();
24+
_mapper = MappingHelper.GetMapper();
2525
}
2626

2727
[Fact]

test/CustomerService.Tests/Controllers/CustomerQueryControllerTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
using CustomerService.DTO.Read;
88
using CustomerService.Repositories;
99
using CustomerService.Tests.Fakes;
10-
using CustomerService.Tests.Utils;
10+
using CustomerService.Tests.Helpers;
1111
using Microsoft.AspNetCore.Mvc;
1212
using Moq;
1313
using Xunit;
@@ -21,7 +21,7 @@ public class CustomerQueryControllerTests
2121

2222
public CustomerQueryControllerTests()
2323
{
24-
_mapper = BaseUtils.GetMapper();
24+
_mapper = MappingHelper.GetMapper();
2525
_repositoryMoq = new Mock<ICustomerRepository>();
2626
}
2727

test/CustomerService.Tests/Domain/CustomerAggregate/Handlers/UpdateCustomerHandlerTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
using CustomerService.Domain.CustomerAggregate.Commands;
88
using CustomerService.Domain.CustomerAggregate.Handlers;
99
using CustomerService.Repositories;
10-
using CustomerService.Tests.Utils;
10+
using CustomerService.Tests.Helpers;
1111
using EventDriven.DDD.Abstractions.Commands;
1212
using EventDriven.DDD.Abstractions.Repositories;
1313
using EventDriven.EventBus.Abstractions;
@@ -23,7 +23,7 @@ public class UpdateCustomerHandlerTests
2323
private readonly Fixture _fixture = new();
2424

2525
private readonly Mock<ILogger<UpdateCustomerHandler>> _loggerMock;
26-
private readonly IMapper _mapper = BaseUtils.GetMapper();
26+
private readonly IMapper _mapper = MappingHelper.GetMapper();
2727
private readonly Mock<ICustomerRepository> _repositoryMock;
2828

2929
public UpdateCustomerHandlerTests()

test/CustomerService.Tests/Helpers/CommandResultExtensionsTests.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
using CustomerService.Domain.CustomerAggregate;
22
using CustomerService.Helpers;
33
using CustomerService.Tests.Fakes;
4-
using CustomerService.Tests.Utils;
54
using EventDriven.DDD.Abstractions.Commands;
65
using Microsoft.AspNetCore.Mvc;
76
using Xunit;
@@ -24,7 +23,7 @@ public void WhenAccepted_AndEntityIsNotPresent_ThenOkResult()
2423
[Fact]
2524
public void WhenAccepted_AndEntityIsPresent_ThenOkObjectResult()
2625
{
27-
var mapper = BaseUtils.GetMapper();
26+
var mapper = MappingHelper.GetMapper();
2827
var cmdResult = new CommandResult(CommandOutcome.Accepted);
2928

3029
var actionResult = cmdResult.ToActionResult(mapper.Map<Customer>(Customers.Customer1));

test/CustomerService.Tests/Utils/BaseUtils.cs renamed to test/CustomerService.Tests/Helpers/MappingHelper.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
using AutoMapper;
1+
using AutoMapper;
22
using CustomerService.Mapping;
33

4-
namespace CustomerService.Tests.Utils;
4+
namespace CustomerService.Tests.Helpers;
55

6-
public static class BaseUtils
6+
public static class MappingHelper
77
{
88
public static IMapper GetMapper()
99
{
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
namespace EventDriven.ReferenceArchitecture.Specs.Configuration;
2+
3+
public class ReferenceArchSpecsSettings
4+
{
5+
public Guid Customer1Id { get; set; }
6+
public Guid Customer2Id { get; set; }
7+
public Guid Customer3Id { get; set; }
8+
public Guid CustomerPubSub1Id { get; set; }
9+
public Guid Order1Id { get; set; }
10+
public Guid Order2Id { get; set; }
11+
public Guid Order3Id { get; set; }
12+
public Guid Order4Id { get; set; }
13+
public Guid OrderPubSub1Id { get; set; }
14+
public Guid OrderPubSub2Id { get; set; }
15+
public string? CustomerServiceBaseAddress { get; set; }
16+
public string? OrderServiceBaseAddress { get; set; }
17+
public bool StartTyeProcess { get; set; }
18+
public TimeSpan TyeProcessTimeout { get; set; }
19+
public TimeSpan AddressUpdateTimeout { get; set; }
20+
}

test/EventDriven.ReferenceArchitecture.Specs/Configuration/ReferenceArchitectureSpecsSettings.cs

Lines changed: 0 additions & 12 deletions
This file was deleted.

0 commit comments

Comments
 (0)