Skip to content

Instantly share code, notes, and snippets.

:octocat:

Tarik Guney tarikguney

:octocat:
Block or report user

Report or block tarikguney

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@tarikguney
tarikguney / reference-finder.cs
Last active Dec 9, 2016
Finding all references in a solution
View reference-finder.cs
/*
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
{
View account-checker-simple-class.cs
public class AccountChecker
{
public bool Exists(AccountNumber accountNumber)
{
CheckIfValidAccountNumber(accountNumber);
var accountInformation = GetAccount(accountNumber);
return accountInformation != null;
}
private void CheckIfValidAccountNumber(AccountNumber accountNumber)
@tarikguney
tarikguney / account-checker-interface-medium.cs
Created Jan 31, 2017
Account Checker Interface - Medium
View account-checker-interface-medium.cs
public interface IAccountChecker
{
bool Exists(AccountNumber accountNumber);
}
public class DatabaseAccountChecker: IAccountChecker {}
public class AzureAccountChecker: IAccountChecker {}
public class XmlAccountChecker: IAccountChecker {}
@tarikguney
tarikguney / account-creator-class-medium.cs
Last active Jan 31, 2017
Account Creator Class for Medium
View account-creator-class-medium.cs
public class AccountCreator {
private IAccountChecker _accountChecker;
private AccountRepository _accountRepository;
public AccountCreator(IAccountChecker accountChecker){
_accountChecker = accountChecker;
_accountRepository = new AccountRepository();
}
@tarikguney
tarikguney / account-creator-used-in-main-method-medium.cs
Created Jan 31, 2017
Account Creator Used in Main Method For Medium
View account-creator-used-in-main-method-medium.cs
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);
}
}
View ninject-code-sample.cs
public class WarriorModule : NinjectModule
{
public override void Load()
{
this.Bind<IWeapon>().To<Sword>();
}
}
@tarikguney
tarikguney / unit-test-dependency-injection.cs
Last active Feb 3, 2017
Unit Testing with Dependency Injection
View unit-test-dependency-injection.cs
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;
}
View Unit-test-example-for-medium.cs
public class AccountCreatorTest{
private IAccountChecker _accountCheckerMock;
private IAccountRepository _accountRepositoryMock;
[TestInitialize]
public void Initialize(){
_accountCheckerMock = new AccountCheckerMock();
_accountRepositoryMock = new AccountRepositoryMock();
}
@tarikguney
tarikguney / http_get.go
Created Jul 12, 2017 — forked from ijt/http_get.go
Example of using http.Get in go (golang)
View http_get.go
package main
import (
"fmt"
"io"
"log"
"net/http"
"os"
)
@tarikguney
tarikguney / Aggregation.cs
Created Oct 8, 2017
Composition vs. Aggregation
View Aggregation.cs
public class Account {
private Profile _profileInfo;
private Login _loginInfo;
public Account(Profile profileInfo, Login loginInfo){
_profile = profileInfo;
_loginInfo = loginInfo;
}
}
You can’t perform that action at this time.