Fork me on GitHub

Markdown version available here

Task 1

This task is to enable simple CRUD operations on a web server.

The testing documentation has links that section of code that was tested.

Requirements

Practical 2 Part 2 Enable CRUD operations in ASP.NET Web API

Practical 3 Part 1 Validate WEB API Input using Annotation

Code

The code for Task 1 can be found in this branch

Dependencies Used

Microsoft.AspNet.WebApi.Cors

This package enables Cross-Origin Resource Sharing (CORS) in ASP.NET Web API

Nuget package manager Install-Package Microsoft.AspNet.WebApi.Cors

Sequence Diagram

V1 APIs

V1 Sequence Diagram
V1 Sequence Diagram

Code to generate sequence diagram using js-sequence-diagrams

Title: ProductsV1 APIs
User->Browser: Visits http://localhost:55905/API/V1/Products
Browser->ProductsV1Controller: [HttpGet]GetAllProducts
ProductsV1Controller->Browser: return Products
Browser->User: return XML file with all Products
User->Browser: Visits http://localhost:55905/API/V1/Products/2
Browser->ProductsV1Controller: [HttpGet]GetProduct
ProductsV1Controller->Browser: return Product
Browser->User: return XML file with requested Product

V2 APIs

V2 Sequence Diagram
V2 Sequence Diagram

Code to generate sequence diagram using js-sequence-diagrams

Title: ProductsV2 APIs
User->Browser: Visits http://localhost:55905/API/V2/Products
Browser->ProductsV2Controller: [HttpGet]GetAllProducts
ProductsV2Controller->Browser: return Products
Browser->User: return XML file with all Products
User->Browser: Visits http://localhost:55905/API/V2/Products/2
Browser->ProductsV2Controller: [HttpGet]GetProduct
ProductsV2Controller->Browser: return Product
Browser->User: return XML file with requested Product
User->Browser: Post http://localhost:55905/API/V2/Products/
Browser->ProductsV2Controller: [HttpPost]PostProduct
Note over ProductsV2Controller: ValidateModel
ProductsV2Controller->Browser: return new Product
Browser->User: return XML file with newly created Product

Testing

V1 APIs

Web

Link to code

V1 Web
V1 Web

Get

Link to code

V1 Get
V1 Get

Get by id

Link to code

V1 Get by Id
V1 Get by Id

V2 APIs

Get

Link to code

V2 Get
V2 Get

Get by id

Link to code

V2 Get by Id
V2 Get by Id

Get by category

Link to code

V2 Get by category
V2 Get by category

Post

Link to code

V2 Post
V2 Post

Put

Link to code

V2 Put
V2 Put

Delete

Link to code

V2 Delete
V2 Delete

V3 APIs

Difference between V2 and V3 controller

Get

Link to code

V3 Get
V3 Get

Post

Link to code

V3 Post
V3 Post

//Did not screenshot the test conducted on the other crud operations but they should be similar to V2 due to similar implementations but with different return messages.


©2018 francisyzy - Github