Last active
August 29, 2015 13:55
-
-
Save danielsilva/8696652 to your computer and use it in GitHub Desktop.
Elemar´s Employee - http://bit.ly/1d8k32v
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
using Domain.Employees; | |
using Domain.Employees.BonusExtensions; | |
class CanGrantBonus | |
{ | |
public void Foo() | |
{ | |
var employee = new Employee( | |
name: "John Doe", | |
salary: 1500 | |
); | |
employee.GrantBonus(200); | |
} | |
} |
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
using Domain.Employees; | |
using Domain.Employees.SalaryExtensions; | |
class CanRaiseSalary | |
{ | |
public void Foo() | |
{ | |
var employee = new Employee( | |
name: "John Doe", | |
salary: 1500 | |
); | |
employee.RaiseSalary(200); | |
} | |
} |
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
namespace Domain.Employees | |
{ | |
public class Employee | |
{ | |
public Employee(string name, decimal salary) | |
{ | |
Name = name; | |
Salary = salary; | |
} | |
public string Name { get; private set; } | |
public decimal Salary { get; internal set; } | |
} | |
} |
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
namespace Domain.Employees.BonusExtensions | |
{ | |
public static class EmployeeBonusExtensions | |
{ | |
public static void GrantBonus(this Employee employee, decimal amount) | |
{ | |
employee.Salary += amount; | |
} | |
} | |
} |
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
namespace Domain.Employees.SalaryExtensions | |
{ | |
public static class EmployeeSalaryExtensions | |
{ | |
public static void RaiseSalary(this Employee employee, decimal amount) | |
{ | |
employee.Salary += amount; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment