Created
July 1, 2017 16:32
-
-
Save marzoukali/d8eee60bb3c081e8d05cc8aab629e67b to your computer and use it in GitHub Desktop.
unittest-example-2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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