Skip to content

Instantly share code, notes, and snippets.

@marzoukali
Created July 1, 2017 16:32
Show Gist options
  • Save marzoukali/d8eee60bb3c081e8d05cc8aab629e67b to your computer and use it in GitHub Desktop.
Save marzoukali/d8eee60bb3c081e8d05cc8aab629e67b to your computer and use it in GitHub Desktop.
unittest-example-2
// Interfaces
public interface IDatabase
{
Invoice GetInvoice(int invoiceId);
}
public interface IPrinter
{
void WriteLine(string text);
}
public interface IDateTimeWrapper
{
DateTime GetNow();
}
// Implementation
public class Database : IDatabase
{
public Invoice GetInvoice(int invoiceId)
{
// Code here ..
}
}
public class Printer : IPrinter
{
public void WriteLine(string text)
{
throw new NotImplementedException();
}
}
public class DateTimeWrapper : IDateTimeWrapper
{
public DateTime GetNow()
{
return DateTime.Now;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment