Giter Site home page Giter Site logo

webapigateways's Introduction

Practical Test

A sample project: managing gateways - master devices that control multiple peripheral devices

Solution Description

Project 1 WebApiGateways

REST service (JSON/HTTP) for storing information about gateways and their associated devices.

  • Programming language: C#
  • Framework: Asp.Net Core 2.2.0
  • Database: MSSQLLocalDB
  • Automated build: AppVeyor

Instructions (Manual):

  • Open provided 'WebApiGateways.sln' file with Visual Studio
  • Resolve any dependency issue
  • Go to 'Tools/NuGet Package Manager/Package Manager Console', write and execute: Update-database
  • Go to 'View/SQL Server Object Explorer' and run provideded 'SQL Script to Import Test Data.sql' file on 'WebApiGatewaysM3DB' database
  • Press CTRL + F5
  • Done

See ENDPOINTS...

Project 2 Unit Tests

Unit Tests for the cases in description
For Gateways controller:

  • Get All Gateways
  • Get A Gateway By Non Existing Serial Number
  • Get A Gateway By Existing Serial Number
  • Add A Gateway Bad Ip Address
  • Add A Gateway Good IpAddress For Devices controller:
  • Get All Devices
  • Get A Device By Non Existing UID
  • Get A Devices By Existing UID
  • Get All Devices Of A Gateway By Its Serial Number
  • Add A Device
  • Add A Device To A Full Gateway
  • Delete A Devices By Its UID

Instructions (Manual):

  • Open provided 'WebApiGateways.sln' file with Visual Studio
  • Resolve any dependency issue
  • Go to 'Test/Windows/Test Explorer' and click on: Run All
  • Done

Project 3 React Basic UI

A React Basic UI for the WebApi Gateway solution.

ENDPOINTS:

Get all Gateways

GET https://{host}:{port}/api/gateways

Get a Gateway by it's serial number

GET https://{host}:{port}/api/gateways/{serialNumber}

Add a Gateway

POST https://{host}:{port}/api/gateways

  • Ex: POST https://localhost:44306/api/gateways body: {
    "SerialNumber":"gw-006", // a unique serial number (string)
    "Name": "GateWay 6", // human-readable name (string)
    "IpAddress":"10.0.0.6" // IPv4 address (string)
    }

Get all Devices

GET https://{host}:{port}/api/devices

Get a Device by it's UID

GET https://{host}:{port}/api/devices/{uid}

Get all Devices of a Gateway

GET https://{host}:{port}/api/devices/gw/{serialNumber}

Add a Device to a Gateway

POST https://{host}:{port}/api/devices/{serialNumber}

  • Ex: POST https://localhost:44306/api/devices/gw-006 body: {
    "UID": 21, // a UID (number)
    "Vendor": "Device Vendor", // vendor name (string)
    "Date": "2021-02-14 22:43:00", // date created (date)
    "Status": true // status Online/Offline (bool)
    }

Add an existing Device to a Gateway

POST https://{host}:{port}/api/devices/{serialNumber}/{uid}

Delete a Device from a Gateway (if there is only a relation deletes the device)

DELETE https://{host}:{port}/api/devices/{serialNumber}/{uid}

Delete a Device from everywhere

DELETE https://{host}:{port}/api/devices/{uid}

webapigateways's People

Contributors

tomriddle537 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.