Skip to content

Instantly share code, notes, and snippets.

View okellodaniel's full-sized avatar
💭
Crafting Software

Daniel Okello okellodaniel

💭
Crafting Software
View GitHub Profile
@okellodaniel
okellodaniel / IntegrationTest.cs
Created August 7, 2021 11:15 — forked from Elfocrash/IntegrationTest.cs
ASP.NET Core Integration tests code from my video: https://www.youtube.com/watch?v=7roqteWLw4s
using System.Net.Http;
using System.Net.Http.Headers;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc.Testing;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection.Extensions;
using Tweetbook.Contracts.V1;
using Tweetbook.Contracts.V1.Requests;
using Tweetbook.Contracts.V1.Responses;
@okellodaniel
okellodaniel / Factorial.java
Created May 21, 2021 09:38 — forked from sergiilagutin/Factorial.java
Java factorial using TDD
public class Factorial {
public int fact(int number) {
int i = 1;
int result = 1;
while (i <= number) {
result = result * i;
i++;
}
return result;
}

S — Single responsibility principle

“Do one thing and do it well”

class or module should have one, and only one, reason to be changed.

Incorrect

class User
{