Skip to content

Instantly share code, notes, and snippets.

View tarikguney's full-sized avatar
💭
Life has been an interesting ride.

Tarik Guney tarikguney

💭
Life has been an interesting ride.
View GitHub Profile
@tarikguney
tarikguney / account-creator-used-in-main-method-medium.cs
Created January 31, 2017 08:15
Account Creator Used in Main Method For Medium
public class Program{
public static void Main(string[] args){
AccountCreator accountCreator = new AccountCreator(new DatabaseAccountChecker());
var accountInfo = GetAccountInfoFromSomewhere();
var result = accountCreator.TryCreateAccount(accountInfo);
Console.WriteLine("Account Creation was succesfull? " + result);
}
}
@tarikguney
tarikguney / account-creator-class-medium.cs
Last active January 31, 2017 08:07
Account Creator Class for Medium
public class AccountCreator {
private IAccountChecker _accountChecker;
private AccountRepository _accountRepository;
public AccountCreator(IAccountChecker accountChecker){
_accountChecker = accountChecker;
_accountRepository = new AccountRepository();
}
@tarikguney
tarikguney / account-checker-interface-medium.cs
Created January 31, 2017 07:51
Account Checker Interface - Medium
public interface IAccountChecker
{
bool Exists(AccountNumber accountNumber);
}
public class DatabaseAccountChecker: IAccountChecker {}
public class AzureAccountChecker: IAccountChecker {}
public class XmlAccountChecker: IAccountChecker {}
@tarikguney
tarikguney / account-checker-simple-class.cs
Created January 31, 2017 07:11
Account Checker Simple Class
public class AccountChecker
{
public bool Exists(AccountNumber accountNumber)
{
CheckIfValidAccountNumber(accountNumber);
var accountInformation = GetAccount(accountNumber);
return accountInformation != null;
}
private void CheckIfValidAccountNumber(AccountNumber accountNumber)
@tarikguney
tarikguney / reference-finder.cs
Last active December 9, 2016 05:32
Finding all references in a solution
/*
Author: Tarik Guney <atarikguney@gmail.com>
GitHub: https://github.com/atarikguney
This class will read a given .sln file and find all the .csproj it has,
and will find the assemblies referenced from within those .csproj files,
and save them to the given text file path.
*/
public class AssemblyNameLister
{