- Open solution by Visual Studio
- Choose Build and Build Solution
The service can run in IISExpress, Console or Docker and the process is similar for all three environments. This instruction will show how to run in IISExpress.
- In Visual Studio, choose IISExpress as Debug Profile
- Start Debugging
- Default endpoint will open at https://localhost:44316/urlscanner
- Browser would show "This is an WebApi for URL scanner"
The service can be requested by any api client. This instruction will show how to send request using Postman
- Run the service
- Open Postman
- Create new request with:
- URL: https://localhost:44316/urlscanner/scan
- Type: POST
- Body: Text to analyze
- Click Send
- Service would return a list of Urls that are found in the text
During the implementation, I wrote some unit tests and these cases can be replicated using Postman.
- Empty case
- Input: Empty
- Output: Empty list
- String contains some Urls
- Input: Visit photo hosting sites such as www.flickr.com, 500px.com, www.freeimagehosting.net and https://postimage.io, and upload these two image files, picture.dog.png and picture.cat.jpeg, there. After that share their links at https://www.facebook.com/ and http://🍕.ws
- Output: [ "http://www.flickr.com", "http://500px.com", "http://www.freeimagehosting.net", "https://postimage.io", "https://www.facebook.com/", "http://🍕.ws" ]
- Duplicated cases
- Input: Visit google.com and http://google.com
- Output: [ "http://google.com" ]