Skip to content

Instantly share code, notes, and snippets.

Created July 9, 2012 13:04
Show Gist options
  • Save anonymous/3076447 to your computer and use it in GitHub Desktop.
Save anonymous/3076447 to your computer and use it in GitHub Desktop.
namespace NinjectTest
{
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
public class Action : IGenre
{
public string GetTopTenMoviesInGenre()
{
return "Die Hard,Raiders of the Lost Ark,Aliens,Mad Max,Terminator,Matrix,Lethal Weapon,Robocop,Bourne Ultimatum,Enter the Dragon";
}
}
}
namespace NinjectTest
{
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
public class Comedy : IGenre
{
public string GetTopTenMoviesInGenre()
{
return "Animal House,Rushmore,Beveley Hills Cop,Groundhog Day,Shaun of the Dead,South Park,Dr Strangelove,Blazing Saddles,Anchorman,Horrible Bosses";
}
}
}
public interface IGenreFactory
{
IGenre GetHorror();
IGenre GetAction();
IGenre GetComedy();
}
public class GenreFactory : IGenreFactory
{
private IKernel kernel;
public GenreFactory(IKernel kernel)
{
this.kernel = kernel;
}
public virtual IGenre GetHorror()
{
return kernel.Get<Horror>();
}
public virtual IGenre GetAction()
{
return kernel.Get<Action>();
}
public virtual IGenre GetComedy()
{
return kernel.Get<Comedy>();
}
}
namespace NinjectTest
{
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
public class Horror : IGenre
{
public string GetTopTenMoviesInGenre()
{
return "Friday the 13th,Scream,Dracula,The Haunting,Suspiria,Dawn of the Dead,The Thing,The Fly,Poltergeist,The Ring";
}
}
}
namespace NinjectTest
{
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
public interface IGenre
{
string GetTopTenMoviesInGenre();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment