-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#18: Synergy.Web.Api.Testing: Sample extended
Added DateTime serialization
- Loading branch information
1 parent
9c7eb0c
commit 21e9ca0
Showing
10 changed files
with
80 additions
and
64 deletions.
There are no files selected for viewing
6 changes: 5 additions & 1 deletion
6
Web/Sample/Synergy.Sample.Web.API.Services/Users/Domain/User.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,14 +1,18 @@ | ||
namespace Synergy.Sample.Web.API.Services.Users.Domain | ||
using System; | ||
|
||
namespace Synergy.Sample.Web.API.Services.Users.Domain | ||
{ | ||
public class User | ||
{ | ||
public string Id { get; } | ||
public Login Login { get; } | ||
public DateTime CreatedOn { get; } | ||
|
||
public User(string id, Login login) | ||
{ | ||
this.Id = id; | ||
this.Login = login; | ||
this.CreatedOn = DateTime.Now; | ||
} | ||
} | ||
} |
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
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 |
---|---|---|
|
@@ -22,17 +22,18 @@ | |
"response": { | ||
"status": "201 Created", | ||
"headers": { | ||
"Location": "http://localhost/api/v1/users/102a023150d94b1b99dbfbd5d6a695d8", | ||
"Location": "http://localhost/api/v1/users/0dd576b44c7a40a4884cc7512272e751", | ||
"api-supported-versions": "1.0", | ||
"Content-Type": "application/json; charset=utf-8", | ||
"Content-Length": "129" | ||
"Content-Length": "182" | ||
}, | ||
"body": { | ||
"user": { | ||
"id": "102a023150d94b1b99dbfbd5d6a695d8", | ||
"id": "0dd576b44c7a40a4884cc7512272e751", | ||
"login": { | ||
"value": "[email protected]" | ||
} | ||
}, | ||
"created": "2024-05-13T13:19:15.8420304+02:00" | ||
} | ||
} | ||
} | ||
|
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 |
---|---|---|
|
@@ -6,8 +6,8 @@ | |
"Manual: User details are returned" | ||
], | ||
"request": { | ||
"description": "Get user located at http://localhost/api/v1/users/102a023150d94b1b99dbfbd5d6a695d8", | ||
"method": "GET /api/v1/users/102a023150d94b1b99dbfbd5d6a695d8", | ||
"description": "Get user located at http://localhost/api/v1/users/0dd576b44c7a40a4884cc7512272e751", | ||
"method": "GET /api/v1/users/0dd576b44c7a40a4884cc7512272e751", | ||
"headers": { | ||
"test": "header" | ||
} | ||
|
@@ -17,14 +17,15 @@ | |
"headers": { | ||
"api-supported-versions": "1.0", | ||
"Content-Type": "application/json; charset=utf-8", | ||
"Content-Length": "129" | ||
"Content-Length": "182" | ||
}, | ||
"body": { | ||
"user": { | ||
"id": "102a023150d94b1b99dbfbd5d6a695d8", | ||
"id": "0dd576b44c7a40a4884cc7512272e751", | ||
"login": { | ||
"value": "[email protected]" | ||
} | ||
}, | ||
"created": "2024-05-13T13:19:15.8420304+02:00" | ||
} | ||
} | ||
} | ||
|
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 |
---|---|---|
|
@@ -6,8 +6,8 @@ | |
"Manual: User details are returned" | ||
], | ||
"request": { | ||
"description": "Get user with id \"102a023150d94b1b99dbfbd5d6a695d8\"", | ||
"method": "GET /api/v1/users/102a023150d94b1b99dbfbd5d6a695d8", | ||
"description": "Get user with id \"0dd576b44c7a40a4884cc7512272e751\"", | ||
"method": "GET /api/v1/users/0dd576b44c7a40a4884cc7512272e751", | ||
"headers": { | ||
"test": "header" | ||
} | ||
|
@@ -17,14 +17,15 @@ | |
"headers": { | ||
"api-supported-versions": "1.0", | ||
"Content-Type": "application/json; charset=utf-8", | ||
"Content-Length": "129" | ||
"Content-Length": "182" | ||
}, | ||
"body": { | ||
"user": { | ||
"id": "102a023150d94b1b99dbfbd5d6a695d8", | ||
"id": "0dd576b44c7a40a4884cc7512272e751", | ||
"login": { | ||
"value": "[email protected]" | ||
} | ||
}, | ||
"created": "2024-05-13T13:19:15.8420304+02:00" | ||
} | ||
} | ||
} | ||
|
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 |
---|---|---|
|
@@ -17,15 +17,16 @@ | |
"headers": { | ||
"api-supported-versions": "1.0", | ||
"Content-Type": "application/json; charset=utf-8", | ||
"Content-Length": "152" | ||
"Content-Length": "207" | ||
}, | ||
"body": { | ||
"users": [ | ||
{ | ||
"id": "102a023150d94b1b99dbfbd5d6a695d8", | ||
"id": "0dd576b44c7a40a4884cc7512272e751", | ||
"login": { | ||
"value": "[email protected]" | ||
} | ||
}, | ||
"created": "2024-05-13T13:19:15.8420304+02:00" | ||
} | ||
] | ||
} | ||
|
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 |
---|---|---|
|
@@ -95,11 +95,11 @@ Content-Length: 129 | |
|
||
### 2.2. Get created user pointed by "Location" header (1 request) | ||
|
||
### 2.2.2. Request to [Get user located at http://localhost/api/v1/users/2fdc2f9a03534536b1b5532a383b7cc0] | ||
### 2.2.2. Request to [Get created user] | ||
|
||
- Request | ||
``` | ||
GET /api/v1/users/102a023150d94b1b99dbfbd5d6a695d8 | ||
GET /api/v1/users/0dd576b44c7a40a4884cc7512272e751 | ||
test: header | ||
``` | ||
|
||
|
@@ -108,13 +108,14 @@ test: header | |
HTTP/1.1 200 OK | ||
api-supported-versions: 1.0 | ||
Content-Type: application/json; charset=utf-8 | ||
Content-Length: 129 | ||
Content-Length: 182 | ||
{ | ||
"user": { | ||
"id": "102a023150d94b1b99dbfbd5d6a695d8", | ||
"id": "0dd576b44c7a40a4884cc7512272e751", | ||
"login": { | ||
"value": "[email protected]" | ||
} | ||
}, | ||
"created": "2024-05-13T13:19:15.8420304+02:00" | ||
} | ||
} | ||
``` | ||
|
@@ -137,11 +138,11 @@ Content-Length: 129 | |
|
||
### 3.1. Get user by id (1 request) | ||
|
||
### 3.1.1. Request to [Get user with id "2fdc2f9a03534536b1b5532a383b7cc0"] | ||
### 3.1.1. Request to [Get user by id] | ||
|
||
- Request | ||
``` | ||
GET /api/v1/users/102a023150d94b1b99dbfbd5d6a695d8 | ||
GET /api/v1/users/0dd576b44c7a40a4884cc7512272e751 | ||
test: header | ||
``` | ||
|
||
|
@@ -150,13 +151,14 @@ test: header | |
HTTP/1.1 200 OK | ||
api-supported-versions: 1.0 | ||
Content-Type: application/json; charset=utf-8 | ||
Content-Length: 129 | ||
Content-Length: 182 | ||
{ | ||
"user": { | ||
"id": "102a023150d94b1b99dbfbd5d6a695d8", | ||
"id": "0dd576b44c7a40a4884cc7512272e751", | ||
"login": { | ||
"value": "[email protected]" | ||
} | ||
}, | ||
"created": "2024-05-13T13:19:15.8420304+02:00" | ||
} | ||
} | ||
``` | ||
|
@@ -171,7 +173,7 @@ Content-Length: 129 | |
|
||
### 3.2. Negative test: Try to get user that do not exist (1 request) | ||
|
||
### 3.2.2. Request to [Get user with id "user-id-that-do-not-exist"] | ||
### 3.2.2. Request to [Get user by id] | ||
|
||
- Request | ||
``` | ||
|
@@ -222,14 +224,15 @@ test: header | |
HTTP/1.1 200 OK | ||
api-supported-versions: 1.0 | ||
Content-Type: application/json; charset=utf-8 | ||
Content-Length: 152 | ||
Content-Length: 207 | ||
{ | ||
"users": [ | ||
{ | ||
"id": "102a023150d94b1b99dbfbd5d6a695d8", | ||
"id": "0dd576b44c7a40a4884cc7512272e751", | ||
"login": { | ||
"value": "[email protected]" | ||
} | ||
}, | ||
"created": "2024-05-13T13:19:15.8420304+02:00" | ||
} | ||
] | ||
} | ||
|
@@ -391,7 +394,7 @@ Content-Length: 351 | |
|
||
### 6.1. Delete user by id (1 request) | ||
|
||
### 6.1.1. Request to [Delete user with id "2fdc2f9a03534536b1b5532a383b7cc0"] | ||
### 6.1.1. Request to [Delete user by id] | ||
|
||
- Request | ||
``` | ||
|
@@ -418,7 +421,7 @@ Content-Length: 2 | |
|
||
### 6.2. Try to get the deleted user (1 request) | ||
|
||
### 6.2.2. Request to [Get user with id "2fdc2f9a03534536b1b5532a383b7cc0"] | ||
### 6.2.2. Request to [Get user by id] | ||
|
||
- Request | ||
``` | ||
|
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