Assignment

  • Provide 2 http endpoints that accepts JSON base64 encoded binary data on both endpoints
    • /v1/diff//left and /v1/diff//right
  • The provided data needs to be diff-ed and the results shall be available on a third end point
    • /v1/diff/
  • The results shall provide the following info in JSON format
    • If equal return that
    • If not of equal size just return that
    • If of same size provide insight in where the diffs are, actual diffs are not needed.
      • So mainly offsets + length in the data
  • Make assumptions in the implementation explicit, choices are good but need to be communicated

Requirements for running

Running Application

  1. If using a local SqlServer proceed to 2, otherwise remember to change the value from ConnectionStrings under the file appsettings.json pointing to your database.

  2. Make Shure you have conected to your Sql Server Local DB (possibly ServerName: "(LocalDb)\MSSQLLocalDB") and run the scripts that create the database and tables.

    Scripts at:

    dbScripts/create_db.sql

  3. Open a console and run at the root of the project

    dotnet run

    After that you would be presented with the Swagger Documentation

Runing Tests

dotnet test

Running Tests With Coverage

dotnet test /p:CollectCoverage=true /p:Exclude="[xunit*]*"

Sugestion of improvement

  • Implementation
    • Implement PUT for updating sides
    • Implement some kind of Authentication and Authorization either by implementing a token generation or by using an external API Manager and validating a JWT Token
  • Technical Debt
    • Increase Test Coverage
    • Remove Both Left and Right Repository since they don't make sense anymore
    • Properly handle http responses
    • Create Models and separate the Controler and Repositories
    • Properly handle model validation
    • Refactor the Comparisson, specialy the insights part wich was poorly implemented