This provides a sample code repository for coding test in AGL before being engaged.
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
src
test
.gitignore
AglCodingTest.sln
AglCodingTest.sln.DotSettings
LICENSE
README.md
Settings.StyleCop

README.md

Coding Test for AGL with Azure Functions

This provides a sample code repository for coding test in AGL before being engaged.

Requirements

Based on the instruction on http://agl-developer-test.azurewebsites.net/, a candidate is required to submit an application to fulfill the requirements.

  • Data source can be aquired from a JSON object by sending an HTTP request to http://agl-developer-test.azurewebsites.net/people.json.
  • The data source needs to be processed to display result with the rules of:
    • Display all cats in alphabetical order,
    • All cats are listed under their owners' gender, and
    • Can owners' genders are considered as headings.
  • Use LINQ for grouping and sorting the data source.

Prerequisites

For your local debugging purpose, the local.settings.json should exist. If it doesn't, create one. The bare minimum content of it should look like:

{
  "IsEncrypted": false,
  "Values": {
    "AzureWebJobsStorage": "UseDevelopmentStorage=true",
    "AzureWebJobsDashboard": "UseDevelopmentStorage=true",

    "Agl.Endpoint": "http://agl-developer-test.azurewebsites.net/people.json"
  }
}

Implementation

In order to satisfy the requirements, I used the serverless architecture – Azure Functions, because:

  • It doesn't need to setup an application environment,
  • It only focuses on the code itself, which is basically business logic, and
  • It's easy to build

The application consists of number of small libraries that only take care of one responsibility respectively – settings, models, services, functions and IoC. Also each project has its corresponding test projects for unit testing.

Reproduction

The application can be run on either local machine or Azure Functions instance on Azure. In order to run this application, use Visual Studio or Azure Function Tooling npm package. If Visual Studio is chosen, follow the steps below:

  • Clone the repository to your local machine.
  • Open AglCodingTest.sln.
  • Build the solution.
  • Press F5 key to run the Azure Function instance locally.
  • Open a web browser and type http://localhost:7071/pets to run the Azure Functions application.
  • The required result will be displayed.
  • A querystring parameter, type can be used to specify the pet type. Currently, the type parameter only considers three values – Dog, Cat and Fish

Valid requests are: