92 lines
6.4 KiB
Gherkin
92 lines
6.4 KiB
Gherkin
Feature: ImportService
|
|
Gets Imports from database
|
|
|
|
Scenario: GetAllAsync Success
|
|
Given the Import table has the following imports
|
|
| ImportId | Start Date | End Date | RecordCount | Success | FileName |
|
|
| 1 | 1/2/2021 5:00:00 AM | 1/2/2021 5:10:00 AM | 25 | true | New Loans 1-2-2021.txt |
|
|
| 2 | 1/3/2021 5:00:00 AM | 1/3/2021 5:15:00 AM | 50 | false | New Loans 1-3-2021.txt |
|
|
| 3 | 1/4/2021 5:00:00 AM | 1/4/2021 5:05:00 AM | 75 | true | New Loans 1-4-2021.txt |
|
|
When I get the list of all imports with the import service
|
|
Then the result from the import service should have 3 imports
|
|
And the first import from the import service has ImportId 3
|
|
|
|
Scenario: GetAllAsync Exception
|
|
Given the Import Repository throws an exception in ListAll
|
|
When I get the list of all imports with the import service
|
|
Then the Import Service throws an exception with the message "Exception of type 'System.Exception' was thrown."
|
|
|
|
Scenario: GetRecentAsync Success
|
|
Given the Import table has the following imports
|
|
| ImportId | Start Date | End Date | RecordCount | Success | FileName | ImportType |
|
|
| 1 | 1/2/2021 5:00:00 AM | 1/2/2021 5:10:00 AM | 25 | true | New Loans 1-2-2021.txt | Active |
|
|
| 2 | 1/3/2021 5:00:00 AM | 1/3/2021 5:15:00 AM | 50 | false | New Loans 1-3-2021.txt | Active |
|
|
| 3 | 1/4/2021 5:00:00 AM | 1/4/2021 5:05:00 AM | 75 | true | New Loans 1-4-2021.txt | Active |
|
|
When I get the list of the top 2 imports with the import service
|
|
Then the result from the import service should have 2 imports
|
|
And the first import from the import service has ImportId 3
|
|
|
|
Scenario: GetRecentAsync Success - more imports asked for then are in the table
|
|
Given the Import table has the following imports
|
|
| ImportId | Start Date | End Date | RecordCount | Success | FileName |ImportType |
|
|
| 1 | 1/2/2021 5:00:00 AM | 1/2/2021 5:10:00 AM | 25 | true | New Loans 1-2-2021.txt |Active |
|
|
| 2 | 1/3/2021 5:00:00 AM | 1/3/2021 5:15:00 AM | 50 | false | New Loans 1-3-2021.txt |Active |
|
|
| 3 | 1/4/2021 5:00:00 AM | 1/4/2021 5:05:00 AM | 75 | true | New Loans 1-4-2021.txt |Active |
|
|
When I get the list of the top 5 imports with the import service
|
|
Then the result from the import service should have 3 imports
|
|
And the first import from the import service has ImportId 3
|
|
|
|
Scenario: GetRecentAsync Exception
|
|
Given the Import Repository throws an exception in ListAll
|
|
When I get the list of the top 5 imports with the import service
|
|
Then the Import Service throws an exception with the message "Exception of type 'System.Exception' was thrown."
|
|
|
|
Scenario: GetByIdAsync Success
|
|
Given the Import table has the following imports
|
|
| ImportId | Start Date | End Date | RecordCount | Success | FileName |ImportType |
|
|
| 1 | 1/2/2021 5:00:00 AM | 1/2/2021 5:10:00 AM | 25 | true | New Loans 1-2-2021.txt |Active |
|
|
| 2 | 1/3/2021 5:00:00 AM | 1/3/2021 5:15:00 AM | 50 | false | New Loans 1-3-2021.txt |Active |
|
|
| 3 | 1/4/2021 5:00:00 AM | 1/4/2021 5:05:00 AM | 75 | true | New Loans 1-4-2021.txt |Active |
|
|
When I get the import with the importId 2 from the import service
|
|
Then the import from the import service has ImportId 2
|
|
|
|
Scenario: GetByIdAsync Exception - Not Found
|
|
Given the Import table has the following imports
|
|
| ImportId | Start Date | End Date | RecordCount | Success | FileName |ImportType |
|
|
| 1 | 1/2/2021 5:00:00 AM | 1/2/2021 5:10:00 AM | 25 | true | New Loans 1-2-2021.txt |Active |
|
|
| 2 | 1/3/2021 5:00:00 AM | 1/3/2021 5:15:00 AM | 50 | false | New Loans 1-3-2021.txt |Active |
|
|
| 3 | 1/4/2021 5:00:00 AM | 1/4/2021 5:05:00 AM | 75 | true | New Loans 1-4-2021.txt |Active |
|
|
When I get the import with the importId 4 from the import service
|
|
Then the Import Service throws an exception with the message "Import with id 4 not found."
|
|
|
|
Scenario: GetByIdAsync Exception - Import Repository exception
|
|
Given the Import Repository throws an exception in FindByIdAsync
|
|
When I get the import with the importId 3 from the import service
|
|
Then the Import Service throws an exception with the message "Exception of type 'System.Exception' was thrown."
|
|
|
|
Scenario: GetLastLoanImport - active when there are only active
|
|
Given the Import table has the following imports
|
|
| ImportId | Start Date | End Date | RecordCount | Success | FileName | ImportType |
|
|
| 1 | 1/2/2021 5:00:00 AM | 1/2/2021 5:10:00 AM | 25 | true | <null> | Active |
|
|
| 2 | 1/3/2021 5:00:00 AM | 1/3/2021 5:15:00 AM | 50 | false | <null> | Active |
|
|
| 3 | 1/4/2021 5:00:00 AM | 1/4/2021 5:05:00 AM | 75 | true | <null> | Active |
|
|
When I get the last loan import of type "Active"
|
|
Then the import from the import service has ImportId 3
|
|
|
|
Scenario: GetLastLoanImport - ignore imports that have a non-null filename
|
|
Given the Import table has the following imports
|
|
| ImportId | Start Date | End Date | RecordCount | Success | FileName | ImportType |
|
|
| 1 | 1/2/2021 5:00:00 AM | 1/2/2021 5:10:00 AM | 25 | true | <null> | Active |
|
|
| 2 | 1/3/2021 5:00:00 AM | 1/3/2021 5:15:00 AM | 50 | false | <null> | Active |
|
|
| 3 | 1/4/2021 5:00:00 AM | 1/4/2021 5:05:00 AM | 75 | true | New Loans 1-4-2021.txt | Active |
|
|
When I get the last loan import of type "Active"
|
|
Then the import from the import service has ImportId 1
|
|
|
|
Scenario: GetLastLoanImport - closed when there are both types
|
|
Given the Import table has the following imports
|
|
| ImportId | Start Date | End Date | RecordCount | Success | FileName | ImportType |
|
|
| 1 | 1/2/2021 5:00:00 AM | 1/2/2021 5:10:00 AM | 25 | true | <null> | Closed |
|
|
| 2 | 1/3/2021 5:00:00 AM | 1/3/2021 5:15:00 AM | 50 | false | <null> | Active |
|
|
| 3 | 1/4/2021 5:00:00 AM | 1/4/2021 5:05:00 AM | 75 | true | <null> | Active |
|
|
When I get the last loan import of type "Closed"
|
|
Then the import from the import service has ImportId 1 |