Example #1
0
        private static IContainer SetUp()
        {
            var container = new Container();

            container.Register(made: Made.Of(() => LocationFactory.Get()), reuse: Reuse.Singleton);
            container.RegisterDelegate <Action <string> >((r) => x => Console.WriteLine(x));
            container.RegisterDelegate <Func <string> >((r) => () => Console.ReadLine());
            container.Register <ILogger>(made: Made.Of(() => LogFactory.Get(Arg.Of <string>())), reuse: Reuse.Singleton);
            container.Register <IConfigurationProvider>(made: Made.Of(() => ConfigurationProviderFactory.Get(Arg.Of <string>())), reuse: Reuse.Singleton);
            container.Register <StationValidator>(reuse: Reuse.Singleton);
            container.Register <IStationProvider, StationProvider>(Reuse.Singleton);
            container.Register <IRadio, Radio>(Reuse.Singleton);
            container.Register <ICommand, DatabaseCommand>();
            container.Register <ICommand, HelpCommand>();
            container.Register <ICommand, ListCommand>();
            container.Register <ICommand, PauseCommand>();
            container.Register <ICommand, PlayCommand>();
            container.Register <ICommand, StartCommand>();
            container.Register <ICommand, VolumeCommand>();
            container.Register <ICommand, StopCommand>();
            container.Register <ICommand, StatusCommand>();
            container.Register <IMainLoop, MainLoop>(reuse: Reuse.Singleton);

            return(container);
        }