-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2e8f967
commit 80e8b6d
Showing
11 changed files
with
1,092 additions
and
222 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
92 changes: 92 additions & 0 deletions
92
...ServiceAssessmentService.Domain.Test/AssessmentRequestDeliveryManagerCompletenessTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
using ServiceAssessmentService.Domain.Model; | ||
|
||
namespace ServiceAssessmentService.Domain.Test; | ||
|
||
public class AssessmentRequestDeliveryManagerCompletenessTests | ||
{ | ||
private static Person ArbitraryValidPerson => new Person | ||
{ | ||
PersonalName = "Arbitrary Personal Name", | ||
FamilyName = "Arbitrary Family Name", | ||
Email = "[email protected]", | ||
}; | ||
private static Person ArbitraryIncompletePerson => new Person | ||
{ | ||
PersonalName = null, | ||
FamilyName = null, | ||
Email = null, | ||
}; | ||
|
||
public static TheoryData<bool?, Person?> CompleteCombinations => new() | ||
{ | ||
// Complete scenarios | ||
// - Declares Delivery Manager is known, Delivery Manager details provided | ||
{true, ArbitraryValidPerson}, | ||
// - Declares Delivery Manager is not known, no Delivery Manager details provided | ||
{false, null}, | ||
|
||
}; | ||
|
||
public static TheoryData<bool?, Person?> IncompleteCombinations => new() | ||
{ | ||
// All other combinations are incomplete/invalid | ||
{null, null}, | ||
{null, ArbitraryValidPerson}, | ||
{null, ArbitraryIncompletePerson}, | ||
|
||
{true, null}, | ||
// {true, ArbitraryValidPerson}, // ignore - valid combination | ||
{true, ArbitraryIncompletePerson}, | ||
|
||
// {false, null}, // ignore - valid combination | ||
{false, ArbitraryValidPerson}, | ||
{false, ArbitraryIncompletePerson}, | ||
|
||
}; | ||
|
||
|
||
[Theory] | ||
[MemberData(nameof(CompleteCombinations))] | ||
public void IsDeliveryManagerComplete_WHEN_CompleteCombinationOfValues_THEN_IsComplete( | ||
bool? hasDeliveryManager, | ||
Person? deliveryManager | ||
) | ||
{ | ||
// Arrange | ||
var assessmentRequest = new AssessmentRequest | ||
{ | ||
HasDeliveryManager = hasDeliveryManager, | ||
DeliveryManager = deliveryManager, | ||
}; | ||
|
||
// Act | ||
var result = assessmentRequest.IsDeliveryManagerComplete(); | ||
|
||
// Assert | ||
Assert.True(result); | ||
} | ||
|
||
[Theory] | ||
[MemberData(nameof(IncompleteCombinations))] | ||
public void IsDeliveryManagerComplete_WHEN_IncompleteCombinationOfValues_THEN_IsComplete( | ||
bool? hasDeliveryManager, | ||
Person? deliveryManager | ||
) | ||
{ | ||
// Arrange | ||
var assessmentRequest = new AssessmentRequest | ||
{ | ||
HasDeliveryManager = hasDeliveryManager, | ||
DeliveryManager = deliveryManager, | ||
}; | ||
|
||
// Act | ||
var result = assessmentRequest.IsDeliveryManagerComplete(); | ||
|
||
// Assert | ||
string deliveryManagerString = deliveryManager?.ToString() ?? "null"; | ||
|
||
Assert.False(result, $"Expected to be incomplete: " + | ||
$"\n- DeliveryManager: {deliveryManagerString}"); | ||
} | ||
} |
Oops, something went wrong.