Skip to content
This repository has been archived by the owner on Oct 14, 2022. It is now read-only.

release: v0.1.0 #19

Merged
merged 171 commits into from
Jun 11, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
171 commits
Select commit Hold shift + click to select a range
7ff66c9
feat(companies): created base structure for companies bounded
amenes12 Jun 9, 2022
ce8b534
feat(companies): implemented base Company model
amenes12 Jun 9, 2022
5562ca0
feat(companies): defined Company repository interface
amenes12 Jun 9, 2022
bca67bb
feat(companies): added Company service members
amenes12 Jun 9, 2022
181547e
feat(companies): created DTOs (resource and request) for Company
amenes12 Jun 9, 2022
b6f339a
feat(companies): implemented mapping members
amenes12 Jun 9, 2022
53651a3
refactor: added nullable value types to properties
amenes12 Jun 9, 2022
3e5d597
refactor: added inheritance from BaseModel class
amenes12 Jun 9, 2022
e9d8397
feat(companies): added companies table to AppDbContext
amenes12 Jun 9, 2022
890a852
refactor: changed data type 'int' to 'long' in Id property
amenes12 Jun 9, 2022
16d599e
feat(companies): added missing DbSet definition
amenes12 Jun 9, 2022
9fd4220
feat(companies): implemented CompanyRepository
amenes12 Jun 9, 2022
3021adf
feat(companies): implemented CompanyService methods
amenes12 Jun 9, 2022
e18f963
feat(companies): added table constraints
amenes12 Jun 9, 2022
3747485
refactor(constraints): updated max length values
amenes12 Jun 9, 2022
4deb391
feat(companies): implemented API controller for Companies
amenes12 Jun 10, 2022
af1c2b1
chore: datasource local storage ignored files
amenes12 Jun 10, 2022
7e2b57b
feat(companies): implemented CompanyService methods
amenes12 Jun 10, 2022
1d9726d
feat(migration): added migration files to database
amenes12 Jun 10, 2022
bfc9050
feat: local dataSource for request testing
amenes12 Jun 10, 2022
9fcd145
feat(companies): added dependency injection for persistence and funct…
amenes12 Jun 10, 2022
9f4ccb5
chore: rename launch profiles for Rider [skip ci]
dalbitresb12 Jun 10, 2022
784b658
Merge pull request #2 from futureleadersupc/chore/rider-task-naming
dalbitresb12 Jun 10, 2022
0e23533
feat(migration): migration was created to create the table offers
AdrianAlzamoraG Jun 10, 2022
7015a91
test(companies): added Company feature file
amenes12 Jun 10, 2022
bd6dd2c
feat(migration): migration was implemented to create the table offers
AdrianAlzamoraG Jun 10, 2022
4a7b6d3
refactor: added media type in Company controller
amenes12 Jun 10, 2022
84e27b3
fix(companies): fixed Company service validation bug
amenes12 Jun 10, 2022
280ec14
chore: fixed .gitignore bug
amenes12 Jun 10, 2022
1f7008a
feat(swagger): enabled swagger annotations to improve documentation
amenes12 Jun 10, 2022
6db3dc3
feat(jobs): implemented domain class
AdrianAlzamoraG Jun 10, 2022
d2310e4
feat(jobs): clase de respuesta de dominio implementada
AdrianAlzamoraG Jun 10, 2022
3471c67
feat(jobs): offer service interface implemented
AdrianAlzamoraG Jun 10, 2022
4c32671
feat(jobs): api endpoint offer controller is implemented
AdrianAlzamoraG Jun 10, 2022
b941695
feat(jobs): outgoing object mapping implemented
AdrianAlzamoraG Jun 10, 2022
0a1f3c7
feat(jobs): incoming mapping and constrains implemented
AdrianAlzamoraG Jun 10, 2022
22c7fb5
feat(jobs): implemented offer repository interface
AdrianAlzamoraG Jun 10, 2022
dbeebc9
feat(persistence): implemented dbcontext class for persistence handling
AdrianAlzamoraG Jun 10, 2022
b20ff7c
Merge pull request #4 from futureleadersupc/docs/swagger
dalbitresb12 Jun 11, 2022
8a65aa4
feat(offer): classes of the persistence layer have been implemented
AdrianAlzamoraG Jun 11, 2022
37fd7b2
feat(offer): the service layer class has been implemented
AdrianAlzamoraG Jun 11, 2022
279965a
style: applied code style formatting
amenes12 Jun 11, 2022
b7c52a3
Merge branch 'develop' into feat/companies-api
amenes12 Jun 11, 2022
550d4ab
feat(users): created base structure for users
gakol28 Jun 11, 2022
2102dcc
feat(user): created users model
gakol28 Jun 11, 2022
d10184c
feat(user): created user resources
gakol28 Jun 11, 2022
71a24db
feat(users): implemented user response
gakol28 Jun 11, 2022
9413fbb
feat(users): defined user service methods
gakol28 Jun 11, 2022
def1dc3
feat(user): defined user repository methods
gakol28 Jun 11, 2022
e9a701e
feat(users): implemented mapping members
gakol28 Jun 11, 2022
46516b5
docs(companies): added swagger annotations in companies controller
amenes12 Jun 11, 2022
c6dc664
fix(users): modified nullable properties
gakol28 Jun 11, 2022
1960503
feat(users): added users to dbcontext
gakol28 Jun 11, 2022
5447a90
feat(user): implemented methods
gakol28 Jun 11, 2022
9481006
test(companies): deleted temporarily .feature file for tests
amenes12 Jun 11, 2022
b4a54ea
Merge branch 'main' into develop
dalbitresb12 Jun 11, 2022
a41ed9e
Merge branch 'develop' into feat/companies-api
dalbitresb12 Jun 11, 2022
2314528
Merge pull request #3 from futureleadersupc/feat/companies-api
dalbitresb12 Jun 11, 2022
462433d
feat(users): created user service
gakol28 Jun 11, 2022
b6e8be8
feat(users): created user controller
gakol28 Jun 11, 2022
81e781a
feat(db): added migration
gakol28 Jun 11, 2022
6575266
fix(users): implemented post method
gakol28 Jun 11, 2022
bcf4f15
feat(db): added migrations
gakol28 Jun 11, 2022
f7bbd10
ci(fix): run on pull request edit
dalbitresb12 Jun 11, 2022
9d4b648
ci: allow CI branches to be merged to develop
dalbitresb12 Jun 11, 2022
c8aa284
feat(offer): migration has been updated to create jobs
AdrianAlzamoraG Jun 11, 2022
5fa833b
ci: use workflow run id for artifact names
dalbitresb12 Jun 11, 2022
d603079
ci: use pull_request event for base branch check
dalbitresb12 Jun 11, 2022
5218bba
Merge pull request #6 from futureleadersupc/ci/fixes
dalbitresb12 Jun 11, 2022
a5f79bd
chore(ide): add VS Code auto-generated settings
dalbitresb12 Jun 11, 2022
aaa0794
feat(offer): added and implemented user stories from jobs api
AdrianAlzamoraG Jun 11, 2022
738055f
feat(offer): the get all offers scenario and its step were added and …
AdrianAlzamoraG Jun 11, 2022
e4a2977
feat(offer): added and implemented the offer without data scenario an…
AdrianAlzamoraG Jun 11, 2022
b52c21c
fix(users): renamed controller file
gakol28 Jun 11, 2022
063981c
Merge branch 'ci/fix-merge' into develop
dalbitresb12 Jun 11, 2022
7e9b6c9
Merge branch 'develop' into chore/vscode-settings
dalbitresb12 Jun 11, 2022
762fce4
fix(users): renamed methods controller
gakol28 Jun 11, 2022
bb4b7fe
Merge pull request #7 from futureleadersupc/chore/vscode-settings
dalbitresb12 Jun 11, 2022
bccd74d
feat(offer): added and implemented the offer with data scenario and i…
AdrianAlzamoraG Jun 11, 2022
dfaf22e
feat(offer): added and implemented the offer invalid post scenario an…
AdrianAlzamoraG Jun 11, 2022
6ee3d9e
feat(offer): the update existing offer scenario and its step were add…
AdrianAlzamoraG Jun 11, 2022
8247d2f
feat(offer): the delete existing offer scenario and its step were add…
AdrianAlzamoraG Jun 11, 2022
aca57b7
feat(offer): unnecessary files removed
AdrianAlzamoraG Jun 11, 2022
3a697cd
fix(users): applied reformat and cleanup
gakol28 Jun 11, 2022
99da388
fix(companies): renamed API controller endpoint to plural
amenes12 Jun 11, 2022
0472de5
feat(offer): offers context was implemented for persistence handling
AdrianAlzamoraG Jun 11, 2022
52958b9
docs(companies): added annotations to DTOs
amenes12 Jun 11, 2022
51f1849
feat(offer): updated offer repository interface
AdrianAlzamoraG Jun 11, 2022
4b7e704
feat(jobs): implemented domain response class
AdrianAlzamoraG Jun 10, 2022
df55972
feat(jobs): offer service interface implemented
AdrianAlzamoraG Jun 10, 2022
fcb33b0
feat(jobs): api endpoint offer controller is implemented
AdrianAlzamoraG Jun 10, 2022
3d0fa2f
feat(jobs): outgoing object mapping implemented
AdrianAlzamoraG Jun 10, 2022
49edd22
feat(jobs): incoming mapping and constrains implemented
AdrianAlzamoraG Jun 10, 2022
8fd6e6e
feat(jobs): implemented offer repository interface
AdrianAlzamoraG Jun 10, 2022
b2b1006
feat(persistence): implemented dbcontext class for persistence handling
AdrianAlzamoraG Jun 10, 2022
bf5f1c6
feat(offer): classes of the persistence layer have been implemented
AdrianAlzamoraG Jun 11, 2022
85b0177
feat(offer): the service layer class has been implemented
AdrianAlzamoraG Jun 11, 2022
5b97139
feat(offer): migration has been updated to create jobs
AdrianAlzamoraG Jun 11, 2022
37544ff
feat(offer): added and implemented user stories from jobs api
AdrianAlzamoraG Jun 11, 2022
799af8b
feat(offer): the get all offers scenario and its step were added and …
AdrianAlzamoraG Jun 11, 2022
d3c1c1d
feat(offer): added and implemented the offer without data scenario an…
AdrianAlzamoraG Jun 11, 2022
1a6be1e
feat(offer): added and implemented the offer with data scenario and i…
AdrianAlzamoraG Jun 11, 2022
b1d8b17
feat(offer): added and implemented the offer invalid post scenario an…
AdrianAlzamoraG Jun 11, 2022
cd22e4e
feat(offer): the update existing offer scenario and its step were add…
AdrianAlzamoraG Jun 11, 2022
149c3d4
feat(offer): the delete existing offer scenario and its step were add…
AdrianAlzamoraG Jun 11, 2022
3015e31
feat(offer): unnecessary files removed
AdrianAlzamoraG Jun 11, 2022
c083ca2
feat(offer): offers context was implemented for persistence handling
AdrianAlzamoraG Jun 11, 2022
21aa11c
feat(offer): updated offer repository interface
AdrianAlzamoraG Jun 11, 2022
c880571
feat(jobs): updated domain class
AdrianAlzamoraG Jun 11, 2022
f61ee02
feat(jobs): implemented offer repository for persistence
AdrianAlzamoraG Jun 11, 2022
03e6738
Merge branch 'develop' into fix/companies
dalbitresb12 Jun 11, 2022
f8752af
Merge branch 'main' into develop
dalbitresb12 Jun 11, 2022
16f84df
Merge branch 'develop' into fix/companies
dalbitresb12 Jun 11, 2022
bc8f2d5
docs: added OpenAPI information about our startup
amenes12 Jun 11, 2022
a2ec864
feat(jobs): outgoing and incoming mapping were updated
AdrianAlzamoraG Jun 11, 2022
7e1330a
feat(jobs): offer service implemented
AdrianAlzamoraG Jun 11, 2022
61daf8d
feat(offer): added offer scoped in dependency Injection configuration
AdrianAlzamoraG Jun 11, 2022
c9cc11b
Merge pull request #8 from futureleadersupc/fix/companies
dalbitresb12 Jun 11, 2022
2fc0f29
Merge pull request #9 from futureleadersupc/docs/waw-api
dalbitresb12 Jun 11, 2022
232a237
Merge branch 'develop' into feat/users
dalbitresb12 Jun 11, 2022
3a8e331
fix(users): added default values
gakol28 Jun 11, 2022
2243e36
fix(users): renamed namespaces
gakol28 Jun 11, 2022
7908686
style(users): applied reformat and clean up
gakol28 Jun 11, 2022
2f44345
Merge pull request #5 from futureleadersupc/feat/users
dalbitresb12 Jun 11, 2022
4c79824
Merge branch 'develop' into feat/jobs
dalbitresb12 Jun 11, 2022
14edee7
test: remove Job feature files
dalbitresb12 Jun 11, 2022
7d45d0f
style: code formatting
dalbitresb12 Jun 11, 2022
1c2ef1f
chore: add release notes auto generation config
dalbitresb12 Jun 11, 2022
37116d2
refactor: applied requested changes
amenes12 Jun 11, 2022
1e34284
Merge branch 'develop' into feat/jobs
dalbitresb12 Jun 11, 2022
4ae5cae
Merge remote-tracking branch 'origin/feat/jobs' into feat/jobs
amenes12 Jun 11, 2022
f75c9f4
Merge remote-tracking branch 'origin/feat/jobs' into feat/jobs
amenes12 Jun 11, 2022
a259e01
refactor: initialized not nullable properties with empty string
amenes12 Jun 11, 2022
42f8521
Merge pull request #10 from futureleadersupc/feat/jobs
dalbitresb12 Jun 11, 2022
a650fdd
docs(offers): added annotations to OffersController
amenes12 Jun 11, 2022
29997b8
docs(users): added annotations to UsersController
amenes12 Jun 11, 2022
7c465b2
refactor(jobs): updated nullable properties
amenes12 Jun 11, 2022
7addc8e
feat(db): added database migration
amenes12 Jun 11, 2022
10fb431
docs(jobs): added swagger schemas to Job Offer DTOs
amenes12 Jun 11, 2022
2949406
docs(users): added swagger schemas to Users DTOs
amenes12 Jun 11, 2022
9f08eb1
docs(users): updated nullable property
amenes12 Jun 11, 2022
dad5f25
docs(jobs): updated nullable attributes
amenes12 Jun 11, 2022
b29fa0b
docs(users): updated nullable attributes
amenes12 Jun 11, 2022
376d673
docs(companies): updated nullable properties
amenes12 Jun 11, 2022
0f81064
style: applied general code reformat and cleanup
amenes12 Jun 11, 2022
c0d2cff
refactor: modified to 200 status in controllers
amenes12 Jun 11, 2022
e5cd285
refactor: deleted redundant annotation in Request models
amenes12 Jun 11, 2022
941ccd8
Merge pull request #11 from futureleadersupc/docs/controllers
dalbitresb12 Jun 11, 2022
bf89664
refactor: move shared files out of weather domain
dalbitresb12 Jun 11, 2022
5a7fd6e
refactor: move AutoMapper defs to domain files
dalbitresb12 Jun 11, 2022
a4b80a1
refactor: move injections into each domain
dalbitresb12 Jun 11, 2022
3eea16d
fix: warnings in Driver.cs
dalbitresb12 Jun 11, 2022
439f852
chore: remove template files
dalbitresb12 Jun 11, 2022
d33cd3d
Merge pull request #12 from futureleadersupc/refactor/shared-files
dalbitresb12 Jun 11, 2022
68c8e79
fix: user service injection registration
dalbitresb12 Jun 11, 2022
9b88f99
Merge pull request #13 from futureleadersupc/fix/user-service-injection
dalbitresb12 Jun 11, 2022
e5e8426
fix: remove incorrect jobs table migration
dalbitresb12 Jun 11, 2022
13214d4
chore: remove forecasts table
dalbitresb12 Jun 11, 2022
b59bd2d
Merge pull request #14 from futureleadersupc/fix/migrations
dalbitresb12 Jun 11, 2022
c5bca31
refactor: rename Company domain to Employers
dalbitresb12 Jun 11, 2022
efb9c33
refactor: company model reference in DbContext
dalbitresb12 Jun 11, 2022
2c927dd
Merge pull request #15 from futureleadersupc/fix/companies
dalbitresb12 Jun 11, 2022
275fa4e
fix(jobs): updated database table name to offers
amenes12 Jun 11, 2022
1ad9a47
Merge pull request #16 from futureleadersupc/fix/offers-db
dalbitresb12 Jun 11, 2022
2eca2e3
fix(users): updated birthdate prop to DateTime variable type
amenes12 Jun 11, 2022
a7c1525
feat(db): added database migration
amenes12 Jun 11, 2022
854aa00
test: added tests for Companies controller
dalbitresb12 Jun 11, 2022
5cefa57
Merge pull request #18 from futureleadersupc/feat/unit-tests
amenes12 Jun 11, 2022
986caf5
Merge branch 'develop' into fix/users-birthdate
dalbitresb12 Jun 11, 2022
17b830e
Merge pull request #17 from futureleadersupc/fix/users-birthdate
dalbitresb12 Jun 11, 2022
532467f
ci: fix base branch check
dalbitresb12 Jun 11, 2022
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
14 changes: 14 additions & 0 deletions .github/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
changelog:
categories:
- title: Enhancements 🎉
labels:
- enhancement
- title: Bugs 🐛
labels:
- bug
- title: Docs 📖
labels:
- documentation
- title: Other Changes
labels:
- '*'
11 changes: 9 additions & 2 deletions .github/workflows/branches.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,23 @@ jobs:
run: |
echo "Current base branch: $BASE_BRANCH"
echo "Branch rule exception: Continuous Integration branches allowed to be merged into main"
- name: Branch is develop being merged to main for release
if: ${{ github.base_ref == 'main' && github.head_ref == 'develop' }}
env:
BASE_BRANCH: ${{ github.base_ref }}
run: |
echo "Current base branch: $BASE_BRANCH"
echo "Branch rule exception: Develop branch is being merged into main"
- name: Branch is not based on develop
if: ${{ github.base_ref != 'develop' && !startsWith(github.head_ref, 'ci/') }}
if: ${{ github.base_ref != 'develop' && github.head_ref != 'develop' && !startsWith(github.head_ref, 'ci/') }}
env:
BASE_BRANCH: ${{ github.base_ref }}
run: |
echo "Current base branch: $BASE_BRANCH"
echo "PRs should only ever be merged into develop"
exit 1
- name: Branch verified as based on develop branch
if: ${{ github.base_ref == 'develop' && !startsWith(github.head_ref, 'ci/') }}
if: ${{ github.base_ref == 'develop' && github.head_ref != 'develop' && !startsWith(github.head_ref, 'ci/') }}
env:
BASE_BRANCH: ${{ github.base_ref }}
run: |
Expand Down
3 changes: 2 additions & 1 deletion .idea/.idea.WAW.API/.idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions .run/WAW.API_ IIS Express.run.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="WAW.API: IIS Express" type="LaunchSettings" factoryName=".NET Launch Settings Profile">
<option name="LAUNCH_PROFILE_PROJECT_FILE_PATH" value="$PROJECT_DIR$/WAW.API/WAW.API.csproj" />
<option name="LAUNCH_PROFILE_TFM" value="net6.0" />
<option name="LAUNCH_PROFILE_NAME" value="IIS Express" />
<option name="USE_EXTERNAL_CONSOLE" value="0" />
<option name="USE_MONO" value="0" />
<option name="RUNTIME_ARGUMENTS" value="" />
<option name="GENERATE_APPLICATIONHOST_CONFIG" value="1" />
<option name="SHOW_IIS_EXPRESS_OUTPUT" value="0" />
<option name="SEND_DEBUG_REQUEST" value="1" />
<option name="ADDITIONAL_IIS_EXPRESS_ARGUMENTS" value="" />
<method v="2">
<option name="Build" />
</method>
</configuration>
</component>
17 changes: 17 additions & 0 deletions .run/WAW.API_ Standalone.run.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="WAW.API: Standalone" type="LaunchSettings" factoryName=".NET Launch Settings Profile">
<option name="LAUNCH_PROFILE_PROJECT_FILE_PATH" value="$PROJECT_DIR$/WAW.API/WAW.API.csproj" />
<option name="LAUNCH_PROFILE_TFM" value="net6.0" />
<option name="LAUNCH_PROFILE_NAME" value="Standalone" />
<option name="USE_EXTERNAL_CONSOLE" value="0" />
<option name="USE_MONO" value="0" />
<option name="RUNTIME_ARGUMENTS" value="" />
<option name="GENERATE_APPLICATIONHOST_CONFIG" value="1" />
<option name="SHOW_IIS_EXPRESS_OUTPUT" value="0" />
<option name="SEND_DEBUG_REQUEST" value="1" />
<option name="ADDITIONAL_IIS_EXPRESS_ARGUMENTS" value="" />
<method v="2">
<option name="Build" />
</method>
</configuration>
</component>
5 changes: 5 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"recommendations": [
"ms-dotnettools.csharp"
]
}
35 changes: 35 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"version": "0.2.0",
"configurations": [
{
// Use IntelliSense to find out which attributes exist for C# debugging
// Use hover for the description of the existing attributes
// For further information visit https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md
"name": ".NET Core Launch (web)",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
// If you have changed target frameworks, make sure to update the program path.
"program": "${workspaceFolder}/WAW.API/bin/Debug/net6.0/WAW.API.dll",
"args": [],
"cwd": "${workspaceFolder}/WAW.API",
"stopAtEntry": false,
// Enable launching a web browser when ASP.NET Core starts. For more information: https://aka.ms/VSCode-CS-LaunchJson-WebBrowser
"serverReadyAction": {
"action": "openExternally",
"pattern": "\\bNow listening on:\\s+(https?://\\S+)"
},
"env": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"sourceFileMap": {
"/Views": "${workspaceFolder}/Views"
}
},
{
"name": ".NET Core Attach",
"type": "coreclr",
"request": "attach"
}
]
}
41 changes: 41 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "build",
"command": "dotnet",
"type": "process",
"args": [
"build",
"${workspaceFolder}/WAW.API/WAW.API.csproj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"problemMatcher": "$msCompile"
},
{
"label": "publish",
"command": "dotnet",
"type": "process",
"args": [
"publish",
"${workspaceFolder}/WAW.API/WAW.API.csproj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"problemMatcher": "$msCompile"
},
{
"label": "watch",
"command": "dotnet",
"type": "process",
"args": [
"watch",
"run",
"--project",
"${workspaceFolder}/WAW.API/WAW.API.csproj"
],
"problemMatcher": "$msCompile"
}
]
}
6 changes: 2 additions & 4 deletions WAW.API.Tests/Drivers/Driver.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
using System;
namespace WAW.API.Tests.Drivers;

namespace WAW.API.Tests.Drivers {
public class Driver {}
}
public class Driver {}
62 changes: 62 additions & 0 deletions WAW.API.Tests/Features/Company.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
Feature: Companies API
As a developer
I want to manage Companies through an API
In order to make it available for client applications.

Scenario: Get all Companies
Given I am a Companies client
And the Companies repository has data
| Id | Name | Address | Email |
| 1 | Google Inc. | Lima, PE | google@fake.com |
| 2 | Meta Inc. | Santiago, CH | meta@fake.com |
When a GET request is sent to Companies
Then a CompanyResource response with status 200 is received
And a list of CompanyResources is included in the body
| Id | Name | Address | Email |
| 1 | Google Inc. | Lima, PE | google@fake.com |
| 2 | Meta Inc. | Santiago, CH | meta@fake.com |

Scenario: Add Company with data
Given I am a Companies client
And the Companies repository has data
| Id | Name | Address | Email |
| 1 | Google Inc. | Lima, PE | google@fake.com |
| 2 | Meta Inc. | Santiago, CH | meta@fake.com |
When a POST request is sent to Companies
| Name | Address | Email |
| Oracle | Buenos Aires, AR | oracle@fake.com |
Then a CompanyResource response with status 200 is received
And a CompanyResource is included in the body
| Id | Name | Address | Email |
| 3 | Oracle | Buenos Aires, AR | oracle@fake.com |

Scenario: Add invalid Company
Given I am a Companies client
When a POST request is sent to Companies
| Name | Address | Email |
| | Quito, EC | company@fake.com |
Then a CompanyResource response with status 400 is received
And a CompanyResource Error Message is included in the body
| Message |
| The Name field is required. |

Scenario: Update existing Company
Given I am a Companies client
And the Companies repository has data
| Id | Name | Address | Email |
| 1 | Google Inc. | Lima, PE | google@fake.com |
When a PUT request is sent to Companies with Id 1
| Name | Address | Email |
| Google Inc. | Huacho, PE | newgoogle@fake.com |
Then a CompanyResource response with status 200 is received
And a CompanyResource is included in the body
| Id | Name | Address | Email |
| 1 | Google Inc. | Huacho, PE | newgoogle@fake.com |

Scenario: Delete existing Company
Given I am a Companies client
And the Companies repository has data
| Id | Name | Address | Email |
| 1 | Google Inc. | Lima, PE | google@fake.com |
When a DELETE request is sent to Companies with Id 1
Then a CompanyResource response with status 200 is received
49 changes: 0 additions & 49 deletions WAW.API.Tests/Features/Forecast.feature

This file was deleted.

43 changes: 43 additions & 0 deletions WAW.API.Tests/Helpers/AppFactory.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Mvc.Testing;
using Microsoft.AspNetCore.TestHost;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using WAW.API.Shared.Persistence.Contexts;

namespace WAW.API.Tests.Helpers;

public static class AppFactory {
public static WebApplicationFactory<Program> GetWebApplicationFactory() {
return new WebApplicationFactory<Program>().WithWebHostBuilder(
builder => {
builder.ConfigureTestServices(
services => {
var descriptor = services.SingleOrDefault(d => d.ServiceType == typeof(DbContextOptions<AppDbContext>));
if (descriptor is not null) {
services.Remove(descriptor);
}

services.AddDbContext<AppDbContext>(
options => options.UseInMemoryDatabase("InMemoryTestDatabase")
.LogTo(Console.WriteLine, LogLevel.Information)
.EnableSensitiveDataLogging()
.EnableDetailedErrors()
);

var provider = services.BuildServiceProvider();
var scope = provider.CreateScope();
var scopedServices = scope.ServiceProvider;
var ctx = scopedServices.GetRequiredService<AppDbContext>();

ctx.Database.EnsureDeleted();
ctx.Database.EnsureCreated();
}
);

builder.UseEnvironment("Testing");
}
);
}
}
5 changes: 5 additions & 0 deletions WAW.API.Tests/Helpers/TextError.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
namespace WAW.API.Tests.Helpers;

public class TextError {
public string Message { get; set; } = string.Empty;
}
38 changes: 38 additions & 0 deletions WAW.API.Tests/Hooks/CompanyHooks.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
using BoDi;
using Microsoft.AspNetCore.Mvc.Testing;
using WAW.API.Employers.Domain.Repositories;
using WAW.API.Shared.Domain.Repositories;
using WAW.API.Tests.Helpers;

namespace WAW.API.Tests.Hooks;

[Binding]
public class CompanyHooks {
private readonly IObjectContainer objectContainer;

public CompanyHooks(IObjectContainer objectContainer) {
this.objectContainer = objectContainer;
}

[BeforeScenario]
public async Task RegisterServices() {
var factory = AppFactory.GetWebApplicationFactory();
await ClearData(factory);
objectContainer.RegisterInstanceAs(factory);
var companiesRepository = factory.Services.GetService(typeof(ICompanyRepository)) as ICompanyRepository;
objectContainer.RegisterInstanceAs(companiesRepository);
var unitOfWork = factory.Services.GetService(typeof(IUnitOfWork)) as IUnitOfWork;
objectContainer.RegisterInstanceAs(unitOfWork);
}

private static async Task ClearData(WebApplicationFactory<Program> factory) {
if (factory.Services.GetService(typeof(ICompanyRepository)) is not ICompanyRepository companyRepository) {
return;
}

var entities = await companyRepository.ListAll();
foreach (var entity in entities) {
companyRepository.Remove(entity);
}
}
}
Loading