Skip to content

Instantly share code, notes, and snippets.

View rhwy's full-sized avatar

Rui Carvalho rhwy

View GitHub Profile
@rhwy
rhwy / Nancy.ViewEngines.NancyRazorLight.cs
Created April 19, 2018 11:26
Nancy 2 RazorLight view engine wrapper for RazorLight templating engine
namespace Nancy.ViewEngines.NancyRazorLight
{
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
using Nancy.Responses;
using RazorLight;
using System.Linq;
using System;
using System.Collections.Generic;
namespace DI2
{
using MonApp;
using MonApp.Adapters;
class Program
{
static void Main(string[] args)

You'll have to create a Smart Hello World.

Your app need to take a name (by default world if none is provided) and write a greeting depending on the time of the day:

  • Good morning X if current hour is < 12h00
  • Good afternoon X if current hour is > 12h00 and < 20h00
  • Good night Xif current hour is after 20h00 and before 6h00 in the morning

You need to make it right:

  • take care of the boundaries of the system (what are your functional code and your technical code, what are invariants,...)
  • your business code should be testable
@rhwy
rhwy / init-solution.sh
Created March 9, 2020 00:25
A very simple script to build generic template to keep on top of your dotnet exercices folder that allows you to quickly scaffold solution and projects structure
mkdir $1
cd $1
git init
echo "bin" >> .gitignore
echo "obj" >> .gitignore
git config core.autocrlf false
git add -A && git commit -m "init repo with gitignore"
mkdir src
mkdir src/$1.App
mkdir src/$1.Core
@rhwy
rhwy / Domain_Application.cs
Last active March 11, 2020 22:51
Refactored version of SmartHelloWorld.
public class Application
{
IOutput output;
public Application(IOutput output)
{
this.output = output;
}
public void Run(string name)
{
if (ApplicationTime.Now.Hour >= 6 && ApplicationTime.Now.Hour < 12 )