Skip to content

Demo Application for the course Back-end fundamentals

Notifications You must be signed in to change notification settings

orodriguez/Okane

Repository files navigation

Okane

Demo Application for the course Back-end fundamentals

Course Outline

Day 1

  1. .NET Project Structure and Project Types
    • Basic dotnet CLI commands.
    • Editors/IDEs for .net/C#
  2. Initial Project Architecture
    • UML Illustrating Projects and Dependencies
  3. Register Expense
    • Unit Testing with xUnit
    • Service objects
    • Repository objects
    • Testing using Fake Implementation
  4. Retrieve all Expenses
    • Enumerables in C#
  5. WebApi Project
    • .NET 7 WebApi Project
    • Controllers
    • Routing
    • HTTP Verbs
    • Dependency Injection Configuration (DIP Principle)
    • Swagger and Swagger UI
  6. Refactor: Introduce IExpensesService interface
    • Using interfaces to facilitate testing with test doubles
  7. Contracts Project
    • Data Transfer Objects
    • Requests: Input DTOs
    • Responses: Output DTOs
  8. Storage Project
    • Moving Storage access to a separated project
  9. Filter Expenses by Category
    • LINQ to Object Collections
    • Query String Parameters in Controllers

Day 2

  1. Get Expense by Id
    • Route Parameters
  2. Get Expense, Id Not Found
    • Nullable Types
    • HTTP Response Codes
    • ProduceResponseType Attribute
    • ActionResult Subtypes
  3. Validate Expense on Registration
    • DataAnnotations Attributes
    • ModelStateDictionary
    • 400 Bad Request Response
  4. UnitTesting Validations
    • Generic Validator
    • ValidationContext
  5. Storage.EntityFramework Project
    • DbContext and DbSets
    • DbContext Configuration
    • Installing dotnet ef CLI tools
    • Create Initial Migration
    • Applying Initial Migration to Database

Day 3

  1. Expense Description
    • Applying Changes Iteratively with Migrations
  2. Expense Invoice URL
  3. Expense Created Date
    • Deterministic UnitTesting
    • Techniques to make unit tests deterministic
  4. Refactor: Introduce Categories Table
    • Database Normalization
    • Refactoring internal Entities without affecting Contract (Orthogonality)
    • Migration Data: Avoiding data lost in Migrations

Day 4

  1. Create Expenses - Category Does not Exist
    • Tupples in C#
    • Result Object Pattern
  2. Bufix: Include Category in Expense
    • Eager Loading
    • Lazy Loading
  3. Integration Tests
    • Types of Unit Testing
    • Integration Testing
    • WebApplicationFactory
    • HttpClient
  4. Refactor: Move Validations to Service
    • Thin Controllers
  5. Delete Expense
  6. Update Expense

Day 5

  1. Sign Up
    • Password Hashers: BCrypt
  2. Token Generation
    • Jwt Token Generation
    • Claims
    • Token Signature
  3. Configuring Authentication and Authorization
    • Password verification
    • AddAuthentication
    • useAuthorization
    • Bearer Token Header
    • Authorization attribute
  4. Relate Expenses and User
  5. Mock password Hasher
    • Mocks: Moq
    • Fast Unit Tests
  6. Move Sensitive Data to Config
    • IConfiguration
    • appsettings.json

Day 6

  1. Database Seed
  2. Organize Dependency Injection Config
    • Extensions Methods
  3. Switch Storage by Config

Download and Install .net 7.

Open a terminal and run

dotnet --version

Install Entity Framework Core tools reference - .NET Core CLI following this instructions.

Build

dotnet build

Run Tests

dotnet test

Run WebApi

dotnet run --project Okane.WebApi/Okane.WebApi.csproj

Install tools

dotnet tool install --global dotnet-ef
dotnet tool update --global dotnet-ef

Verify instalation

dotnet ef

Development Environment

  • I would recommend Rider
  • The project also works with VS Code

VS Code Extensions

About

Demo Application for the course Back-end fundamentals

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages