-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Added Ched finders logic * updated decision service not to send out decision when no checks exist and updated tests * tidy up some code * Updated tests * Fixed up check tests --------- Co-authored-by: Thomas Anderson <[email protected]> Co-authored-by: Craig Edmunds <[email protected]>
- Loading branch information
1 parent
5259079
commit 5862145
Showing
17 changed files
with
384 additions
and
47 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
51 changes: 48 additions & 3 deletions
51
Btms.Business.Tests/Services/Decisions/Finders/ChedADecisionFinderTests.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 |
---|---|---|
@@ -1,19 +1,64 @@ | ||
using Btms.Business.Services.Decisions; | ||
using Btms.Business.Services.Decisions.Finders; | ||
using Btms.Model.Ipaffs; | ||
using FluentAssertions; | ||
using Xunit; | ||
|
||
namespace Btms.Business.Tests.Services.Decisions.Finders; | ||
|
||
public class ChedADecisionFinderTests | ||
{ | ||
[Fact] | ||
public async Task Find_Should_DoThings() | ||
[Theory] | ||
[InlineData(true, DecisionDecisionEnum.AcceptableForTranshipment, null, DecisionCode.E03)] | ||
[InlineData(true, DecisionDecisionEnum.AcceptableForTransit, null, DecisionCode.E03)] | ||
[InlineData(true, DecisionDecisionEnum.AcceptableForInternalMarket, null, DecisionCode.C03)] | ||
[InlineData(true, DecisionDecisionEnum.AcceptableForTemporaryImport, null, DecisionCode.C05)] | ||
[InlineData(true, DecisionDecisionEnum.HorseReEntry, null, DecisionCode.C06)] | ||
|
||
[InlineData(true, DecisionDecisionEnum.NonAcceptable, null, DecisionCode.X00)] | ||
[InlineData(true, DecisionDecisionEnum.AcceptableIfChanneled, null, DecisionCode.X00)] | ||
[InlineData(true, DecisionDecisionEnum.AcceptableForSpecificWarehouse, null, DecisionCode.X00)] | ||
[InlineData(true, DecisionDecisionEnum.AcceptableForPrivateImport, null, DecisionCode.X00)] | ||
[InlineData(true, DecisionDecisionEnum.AcceptableForTransfer, null, DecisionCode.X00)] | ||
|
||
[InlineData(null, null, null, DecisionCode.X00)] | ||
|
||
[InlineData(false,null, DecisionNotAcceptableActionEnum.Euthanasia, DecisionCode.N02)] | ||
[InlineData(false, null, DecisionNotAcceptableActionEnum.Reexport, DecisionCode.N04)] | ||
[InlineData(false, null, DecisionNotAcceptableActionEnum.Slaughter, DecisionCode.N02)] | ||
|
||
[InlineData(false, null, DecisionNotAcceptableActionEnum.Redispatching, DecisionCode.X00)] | ||
[InlineData(false, null, DecisionNotAcceptableActionEnum.Destruction, DecisionCode.X00)] | ||
[InlineData(false, null, DecisionNotAcceptableActionEnum.Transformation, DecisionCode.X00)] | ||
[InlineData(false, null, DecisionNotAcceptableActionEnum.Other, DecisionCode.X00)] | ||
[InlineData(false, null, DecisionNotAcceptableActionEnum.EntryRefusal, DecisionCode.X00)] | ||
[InlineData(false, null, DecisionNotAcceptableActionEnum.QuarantineImposed, DecisionCode.X00)] | ||
[InlineData(false, null, DecisionNotAcceptableActionEnum.SpecialTreatment, DecisionCode.X00)] | ||
[InlineData(false, null, DecisionNotAcceptableActionEnum.IndustrialProcessing, DecisionCode.X00)] | ||
[InlineData(false, null, DecisionNotAcceptableActionEnum.ReDispatch, DecisionCode.X00)] | ||
[InlineData(false, null, DecisionNotAcceptableActionEnum.UseForOtherPurposes, DecisionCode.X00)] | ||
|
||
public void DecisionFinderTest(bool? consignmentAcceptable, DecisionDecisionEnum? decision, DecisionNotAcceptableActionEnum? notAcceptableAction, DecisionCode expectedCode) | ||
{ | ||
// Arrange | ||
var notification = new ImportNotification | ||
{ | ||
PartTwo = new PartTwo | ||
{ | ||
Decision = new Decision | ||
{ | ||
ConsignmentAcceptable = consignmentAcceptable, | ||
DecisionEnum = decision, | ||
NotAcceptableAction = notAcceptableAction | ||
} | ||
} | ||
}; | ||
var sut = new ChedADecisionFinder(); | ||
|
||
// Act | ||
var result = sut.FindDecision(notification); | ||
|
||
// Assert | ||
await Task.CompletedTask; | ||
result.DecisionCode.Should().Be(expectedCode); | ||
} | ||
} |
53 changes: 49 additions & 4 deletions
53
Btms.Business.Tests/Services/Decisions/Finders/ChedDDecisionFinderTests.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 |
---|---|---|
@@ -1,19 +1,64 @@ | ||
using Btms.Business.Services.Decisions; | ||
using Btms.Business.Services.Decisions.Finders; | ||
using Btms.Model.Ipaffs; | ||
using FluentAssertions; | ||
using Xunit; | ||
|
||
namespace Btms.Business.Tests.Services.Decisions.Finders; | ||
|
||
public class ChedDDecisionFinderTests | ||
{ | ||
[Fact] | ||
public async Task Find_Should_DoThings() | ||
[Theory] | ||
[InlineData(true, DecisionDecisionEnum.AcceptableForInternalMarket, null, DecisionCode.C03)] | ||
|
||
[InlineData(true, DecisionDecisionEnum.AcceptableForTranshipment, null, DecisionCode.X00)] | ||
[InlineData(true, DecisionDecisionEnum.AcceptableForTransit, null, DecisionCode.X00)] | ||
[InlineData(true, DecisionDecisionEnum.AcceptableForTemporaryImport, null, DecisionCode.X00)] | ||
[InlineData(true, DecisionDecisionEnum.HorseReEntry, null, DecisionCode.X00)] | ||
[InlineData(true, DecisionDecisionEnum.NonAcceptable, null, DecisionCode.X00)] | ||
[InlineData(true, DecisionDecisionEnum.AcceptableIfChanneled, null, DecisionCode.X00)] | ||
[InlineData(true, DecisionDecisionEnum.AcceptableForSpecificWarehouse, null, DecisionCode.X00)] | ||
[InlineData(true, DecisionDecisionEnum.AcceptableForPrivateImport, null, DecisionCode.X00)] | ||
[InlineData(true, DecisionDecisionEnum.AcceptableForTransfer, null, DecisionCode.X00)] | ||
|
||
[InlineData(null, null, null, DecisionCode.X00)] | ||
|
||
[InlineData(false, null, DecisionNotAcceptableActionEnum.Redispatching, DecisionCode.N04)] | ||
[InlineData(false, null, DecisionNotAcceptableActionEnum.Destruction, DecisionCode.N02)] | ||
[InlineData(false, null, DecisionNotAcceptableActionEnum.Transformation, DecisionCode.N03)] | ||
[InlineData(false, null, DecisionNotAcceptableActionEnum.Other, DecisionCode.N07)] | ||
|
||
[InlineData(false, null, DecisionNotAcceptableActionEnum.Euthanasia, DecisionCode.X00)] | ||
[InlineData(false, null, DecisionNotAcceptableActionEnum.Reexport, DecisionCode.X00)] | ||
[InlineData(false, null, DecisionNotAcceptableActionEnum.Slaughter, DecisionCode.X00)] | ||
[InlineData(false, null, DecisionNotAcceptableActionEnum.EntryRefusal, DecisionCode.X00)] | ||
[InlineData(false, null, DecisionNotAcceptableActionEnum.QuarantineImposed, DecisionCode.X00)] | ||
[InlineData(false, null, DecisionNotAcceptableActionEnum.SpecialTreatment, DecisionCode.X00)] | ||
[InlineData(false, null, DecisionNotAcceptableActionEnum.IndustrialProcessing, DecisionCode.X00)] | ||
[InlineData(false, null, DecisionNotAcceptableActionEnum.ReDispatch, DecisionCode.X00)] | ||
[InlineData(false, null, DecisionNotAcceptableActionEnum.UseForOtherPurposes, DecisionCode.X00)] | ||
|
||
public void DecisionFinderTest(bool? consignmentAcceptable, DecisionDecisionEnum? decision, DecisionNotAcceptableActionEnum? notAcceptableAction, DecisionCode expectedCode) | ||
{ | ||
// Arrange | ||
var notification = new ImportNotification | ||
{ | ||
PartTwo = new PartTwo | ||
{ | ||
Decision = new Decision | ||
{ | ||
ConsignmentAcceptable = consignmentAcceptable, | ||
DecisionEnum = decision, | ||
NotAcceptableAction = notAcceptableAction | ||
} | ||
} | ||
}; | ||
var sut = new ChedDDecisionFinder(); | ||
|
||
// Act | ||
var result = sut.FindDecision(notification); | ||
|
||
// Assert | ||
await Task.CompletedTask; | ||
result.DecisionCode.Should().Be(expectedCode); | ||
} | ||
} |
52 changes: 48 additions & 4 deletions
52
Btms.Business.Tests/Services/Decisions/Finders/ChedPDecisionFinderTests.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 |
---|---|---|
@@ -1,19 +1,63 @@ | ||
using Btms.Business.Services.Decisions; | ||
using Btms.Business.Services.Decisions.Finders; | ||
using Btms.Model.Ipaffs; | ||
using FluentAssertions; | ||
using Xunit; | ||
|
||
namespace Btms.Business.Tests.Services.Decisions.Finders; | ||
|
||
public class ChedPDecisionFinderTests | ||
{ | ||
[Fact] | ||
public async Task Find_Should_DoThings() | ||
[Theory] | ||
[InlineData(true, DecisionDecisionEnum.AcceptableForInternalMarket, null, DecisionCode.C03)] | ||
[InlineData(true, DecisionDecisionEnum.AcceptableForTransit, null, DecisionCode.E03)] | ||
[InlineData(true, DecisionDecisionEnum.AcceptableIfChanneled, null, DecisionCode.C06)] | ||
[InlineData(true, DecisionDecisionEnum.AcceptableForTranshipment, null, DecisionCode.E03)] | ||
[InlineData(true, DecisionDecisionEnum.AcceptableForSpecificWarehouse, null, DecisionCode.E03)] | ||
|
||
[InlineData(true, DecisionDecisionEnum.AcceptableForTemporaryImport, null, DecisionCode.X00)] | ||
[InlineData(true, DecisionDecisionEnum.HorseReEntry, null, DecisionCode.X00)] | ||
[InlineData(true, DecisionDecisionEnum.NonAcceptable, null, DecisionCode.X00)] | ||
[InlineData(true, DecisionDecisionEnum.AcceptableForPrivateImport, null, DecisionCode.X00)] | ||
[InlineData(true, DecisionDecisionEnum.AcceptableForTransfer, null, DecisionCode.X00)] | ||
|
||
[InlineData(null, null, null, DecisionCode.X00)] | ||
|
||
[InlineData(false, null, DecisionNotAcceptableActionEnum.Reexport, DecisionCode.N04)] | ||
[InlineData(false, null, DecisionNotAcceptableActionEnum.Destruction, DecisionCode.N02)] | ||
[InlineData(false, null, DecisionNotAcceptableActionEnum.Transformation, DecisionCode.N03)] | ||
[InlineData(false, null, DecisionNotAcceptableActionEnum.Other, DecisionCode.N07)] | ||
|
||
[InlineData(false, null, DecisionNotAcceptableActionEnum.Euthanasia, DecisionCode.X00)] | ||
[InlineData(false, null, DecisionNotAcceptableActionEnum.Slaughter, DecisionCode.X00)] | ||
[InlineData(false, null, DecisionNotAcceptableActionEnum.Redispatching, DecisionCode.X00)] | ||
[InlineData(false, null, DecisionNotAcceptableActionEnum.EntryRefusal, DecisionCode.X00)] | ||
[InlineData(false, null, DecisionNotAcceptableActionEnum.QuarantineImposed, DecisionCode.X00)] | ||
[InlineData(false, null, DecisionNotAcceptableActionEnum.SpecialTreatment, DecisionCode.X00)] | ||
[InlineData(false, null, DecisionNotAcceptableActionEnum.IndustrialProcessing, DecisionCode.X00)] | ||
[InlineData(false, null, DecisionNotAcceptableActionEnum.ReDispatch, DecisionCode.X00)] | ||
[InlineData(false, null, DecisionNotAcceptableActionEnum.UseForOtherPurposes, DecisionCode.X00)] | ||
public void DecisionFinderTest(bool? consignmentAcceptable, DecisionDecisionEnum? decision, DecisionNotAcceptableActionEnum? notAcceptableAction, DecisionCode expectedCode) | ||
{ | ||
// Arrange | ||
var notification = new ImportNotification | ||
{ | ||
PartTwo = new PartTwo | ||
{ | ||
Decision = new Decision | ||
{ | ||
ConsignmentAcceptable = consignmentAcceptable, | ||
DecisionEnum = decision, | ||
NotAcceptableAction = notAcceptableAction | ||
} | ||
} | ||
}; | ||
var sut = new ChedPDecisionFinder(); | ||
|
||
// Act | ||
var result = sut.FindDecision(notification); | ||
|
||
// Assert | ||
await Task.CompletedTask; | ||
result.DecisionCode.Should().Be(expectedCode); | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,8 @@ namespace Btms.Business.Services.Decisions; | |
|
||
public enum DecisionCode | ||
{ | ||
H01, | ||
H02, | ||
E03, | ||
C03, | ||
C05, | ||
|
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
Oops, something went wrong.