예제 #1
0
        public LastFMStatsControllerTests()
        {
            LastFMCredentialsTestingConfiguration testingConfiguration = new LastFMCredentialsTestingConfiguration();
            LastFMCredentials credentials = new LastFMCredentials(testingConfiguration.APIKey, testingConfiguration.SharedSecret);

            _controller = new LastFMStatsController(credentials);
        }
예제 #2
0
        public AlbumRepositoryTests()
        {
            LastFMCredentialsTestingConfiguration testingConfiguration = new LastFMCredentialsTestingConfiguration();
            LastFMCredentials credentials = new LastFMCredentials(testingConfiguration.APIKey, testingConfiguration.SharedSecret);
            IMapper           mapper      = new Mapper(new MapperConfiguration(cfg => { cfg.AddProfile <LastFMProfile>(); }));

            _repo = new AlbumRepository(credentials, mapper);
        }
예제 #3
0
        public void LastFMStatsControllerTests_Init_InvalidCredentials()
        {
            // Arrange
            LastFMCredentials credentials = null;

            // Act
            LastFMStatsController controller = new LastFMStatsController(credentials);

            // Assert
            Assert.IsNotNull(controller);
        }
예제 #4
0
        public void LastFMStatsControllerTests_Init()
        {
            // Arrange
            LastFMCredentialsTestingConfiguration testingConfiguration = new LastFMCredentialsTestingConfiguration();
            LastFMCredentials credentials = new LastFMCredentials(testingConfiguration.APIKey, testingConfiguration.SharedSecret);

            // Act
            LastFMStatsController controller = new LastFMStatsController(credentials);

            // Assert
            Assert.IsNotNull(controller);
        }
        private void AddBindings()
        {
            kernel.Bind <IResumeRepository>().To <XMLFilesResumeRepository>();
            kernel.Bind <IWorkRepository>().To <XMLFilesWorkRepository>();

            // lastfm
            string            apiKey            = System.Configuration.ConfigurationManager.AppSettings["lastfm_APIKey"];
            string            sharedSecret      = System.Configuration.ConfigurationManager.AppSettings["lastfm_SharedSecret"];
            LastFMCredentials lastFMCredentials = new LastFMCredentials(apiKey, sharedSecret);

            kernel.Bind <ILastFMRepository>().To <LastFMRepository>().WithConstructorArgument("lastFMCredentials", lastFMCredentials);
        }
예제 #6
0
        public LastFMStatsController(LastFMCredentials credentials)
        {
            if (credentials == null)
            {
                throw new InvalidCredentialsException();
            }

            LastFMServiceFactory lastFMServiceFactory = new LastFMServiceFactory(credentials);

            _lastFMUserService   = lastFMServiceFactory.GetLastFMUserService();
            _lastFMArtistService = lastFMServiceFactory.GetLastFMArtistService();
            _lastFMAlbumService  = lastFMServiceFactory.GetLastFMAlbumService();
        }
예제 #7
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddRazorPages();
            services.AddKendo();

            services.AddScoped <IResumeRepository, XmlFilesResumeRepository>();
            services.AddScoped <IWorkRepository, XmlFilesWorkRepository>();
            services.AddScoped <IFootyRepository, XmlFilesFootyRepository>();

            // LastFM
            string            lastFMAPIKey       = Configuration["LastFMCredentials:APIKey"];
            string            lastFMSharedSecret = Configuration["LastFMCredentials:SharedSecret"];
            LastFMCredentials credentials        = new LastFMCredentials()
            {
                APIKey       = lastFMAPIKey,
                SharedSecret = lastFMSharedSecret
            };

            services.AddScoped <ILastFMStatsService>(_ => new LastFMStatsService(credentials));
        }
 public AlbumRepository(LastFMCredentials credentials, IMapper mapper) : base(credentials, mapper)
 {
 }
 protected LastFMRepository(LastFMCredentials credentials, IMapper mapper)
 {
     _lastFMCredentials = credentials;
     _mapper            = mapper;
 }
 public LastFMRepositoryFactory(LastFMCredentials credentials)
 {
     _credentials = credentials;
     _mapper      = new Mapper(new MapperConfiguration(cfg => { cfg.AddProfile <LastFMProfile>(); }));
 }
 public LastFMStatsService(LastFMCredentials credentials)
 {
     _controller = new LastFMStatsController(credentials);
 }
 public LastFMServiceFactory(LastFMCredentials credentials)
 {
     _repositoryFactory = new LastFMRepositoryFactory(credentials);
 }
 public LastFMRepository(LastFMCredentials lastFMCredentials)
 {
     _lastFMCredentials = lastFMCredentials;
 }