This file contains 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
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); | |
} | |
} |
This file contains 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
public class AccountCreator { | |
private IAccountChecker _accountChecker; | |
private AccountRepository _accountRepository; | |
public AccountCreator(IAccountChecker accountChecker){ | |
_accountChecker = accountChecker; | |
_accountRepository = new AccountRepository(); | |
} | |
This file contains 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
public interface IAccountChecker | |
{ | |
bool Exists(AccountNumber accountNumber); | |
} | |
public class DatabaseAccountChecker: IAccountChecker {} | |
public class AzureAccountChecker: IAccountChecker {} | |
public class XmlAccountChecker: IAccountChecker {} |
This file contains 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
public class AccountChecker | |
{ | |
public bool Exists(AccountNumber accountNumber) | |
{ | |
CheckIfValidAccountNumber(accountNumber); | |
var accountInformation = GetAccount(accountNumber); | |
return accountInformation != null; | |
} | |
private void CheckIfValidAccountNumber(AccountNumber accountNumber) |
This file contains 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
/* | |
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 | |
{ |
NewerOlder