Skip to content

Commit

Permalink
R: Move factory to EmployeeFilter class
Browse files Browse the repository at this point in the history
  • Loading branch information
ericgu committed Mar 15, 2016
1 parent e1b3837 commit 8ba1511
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
7 changes: 7 additions & 0 deletions EmployeeFilter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,12 @@ public static bool Matches(EmployeeFilter employeeFilter, string name, int age,
}
return true;
}

public static EmployeeFilter CreateEmployeeFilter()
{
EmployeeFilter employeeFilter = new EmployeeFilter(EmployeeFilterType.ByName, "T");
employeeFilter.ValidateEmployeeFilter();
return employeeFilter;
}
}
}
9 changes: 1 addition & 8 deletions Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class Program
static void Main(string[] args)
{
Yucky yucky = new Yucky();
var employeeFilter = CreateEmployeeFilter();
var employeeFilter = EmployeeFilter.CreateEmployeeFilter();
var employees = Yucky.GetEmployees(employeeFilter, new FakeSqlConnection());

foreach (Employee employee in employees)
Expand All @@ -17,12 +17,5 @@ static void Main(string[] args)
}

}

private static EmployeeFilter CreateEmployeeFilter()
{
EmployeeFilter employeeFilter = new EmployeeFilter(EmployeeFilterType.ByName, "T");
employeeFilter.ValidateEmployeeFilter();
return employeeFilter;
}
}
}

0 comments on commit 8ba1511

Please sign in to comment.