GithubHelp home page GithubHelp logo

shoppingbasketapi's Introduction

USING NUNIT V3 FOR THE UNIT TESTS

The Project is setup to Run on port 61063 and should automatically open the url -> http://localhost:61063/swagger

Added some initial data for api testing purposes:

 var basketDefault = new ShoppingBasket
            {
                BasketId = 1,
                CustomerId = 1
            };

            basketDefault.OrderItems.Add(new ShoppingBasketItem
            {
                ItemId = 1,
                ProductName = "Red Rising Hardcover Book",
                ProductId = 123,
                Price = 15.00m,
                Quantity = 1
            });

            basketDefault.OrderItems.Add(new ShoppingBasketItem
            {
                ItemId = 2,
                ProductName = "Lord Of The Rings",
                ProductId = 456,
                Price = 15.00m,
                Quantity = 1
            });


So you should be able to retrieve that basket to play around in Swagger.


SOME IMPROVEMENTS I WOULD DO IF I HAD MORE TIME / IF IT WAS REAL PRODUCTION PROJECT


- I did not have time to create the Client (however I did setup swagger so that provide documentation on how to call the api and you should be able to test it). 
Creating a client should be easy just using HttpClient and then using GetAsync or PostAsJsonAsync or similar
- I would have clarify the requirements better to understand what activate a membership entitles and what is a shipping slip, etc (now i just made assumptions), 
and spend bit more time understanding what kind of rules can there be if we can design something that make it even easier to import and execute rules
- Would have using some Dynamic mock object framework (like rhinoMocks or Moq) to mock some services and repos for the tests.
- Would have implemented a proper repository rather than static list in memory
- Would have implemented more validations and checks around the Models like avoid creating objects without basic fields, etc. Also protected them more so certain fields can be modified in certain scenarios, etc
- Would have implemented better Response management in the API like I did for the Get Basket endpoint returning 404 with a message if Basket does not exists.

shoppingbasketapi's People

Contributors

dcarles avatar

Stargazers

Roman avatar

Watchers

 avatar

Forkers

d-e-f-e-a-t

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.