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 | |
{ |
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
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 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 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 WarriorModule : NinjectModule | |
{ | |
public override void Load() | |
{ | |
this.Bind<IWeapon>().To<Sword>(); | |
} | |
} |
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{ | |
// Interface'ler tanımlıyoruz. Dolayısıyla kendi sınıflarımızı rahatlıkla kullanabiliriz. | |
private IAccountChecker _accountChecker; | |
private IAccountRepository _accountRepository; | |
// Dependency'lerimizi constructor method vasıtasıyla enjekte ediyoruz. | |
public AccountCreator(IAccountChecker accountChecker, IAccountRepository accountRepository){ | |
_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 class AccountCreatorTest{ | |
private IAccountChecker _accountCheckerMock; | |
private IAccountRepository _accountRepositoryMock; | |
[TestInitialize] | |
public void Initialize(){ | |
_accountCheckerMock = new AccountCheckerMock(); | |
_accountRepositoryMock = new AccountRepositoryMock(); | |
} | |
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
package main | |
import ( | |
"fmt" | |
"io" | |
"log" | |
"net/http" | |
"os" | |
) |
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 Account { | |
private Profile _profileInfo; | |
private Login _loginInfo; | |
public Account(Profile profileInfo, Login loginInfo){ | |
_profile = profileInfo; | |
_loginInfo = loginInfo; | |
} | |
} |
OlderNewer