Inheritance: IPlayApi, IEnableLogger
        public void MakeAlbumSearchIntegrationTest()
        {
            var kernel = new MoqMockingKernel();
            var client = new RestClient(IntegrationTestUrl.Current);

            client.AddDefaultHeader("Authorization", IntegrationTestUrl.Token);
            kernel.Bind<IBlobCache>().To<TestBlobCache>();

            var api = new PlayApi(client, kernel.Get<IBlobCache>());

            var result = api.AllSongsOnAlbum("LCD Soundsystem", "Sound Of Silver")
                .Timeout(TimeSpan.FromSeconds(9.0), RxApp.TaskpoolScheduler)
                .First();

            this.Log().Info(String.Join(",", result.Select(x => x.name)));
            result.Count.Should().BeGreaterThan(2);
        }
        public void FetchNowPlayingIntegrationTest()
        {
            var kernel = new MoqMockingKernel();
            var client = new RestClient(IntegrationTestUrl.Current);

            client.AddDefaultHeader("Authorization", IntegrationTestUrl.Token);
            kernel.Bind<IBlobCache>().To<TestBlobCache>();

            var api = new PlayApi(client, kernel.Get<IBlobCache>());

            var result = api.NowPlaying()
                .Timeout(TimeSpan.FromSeconds(9.0), RxApp.TaskpoolScheduler)
                .First();

            this.Log().Info(result.ToString());
            result.id.Should().NotBeNullOrEmpty();
        }
        public IObservable<Unit> ConnectToPlay(string baseUrl, string token)
        {
            var client = new RestClient(baseUrl);
            client.AddDefaultHeader("Authorization", token);

            var api = new PlayApi(client, null);
            return api.NowPlaying().Select(_ => Unit.Default);
        }
        PlayApi createPlayApiFromCreds(string baseUrl, string token)
        {
            var localMachine = Kernel.Get<IBlobCache>("LocalMachine");
            var rc = new RestClient(baseUrl);
            rc.AddDefaultHeader("Authorization", token);

            var ret = new PlayApi(rc, localMachine);
            return ret;
        }
Beispiel #5
0
        PlayApi createPlayApiFromCreds(string baseUrl, string token)
        {
            var rc = new HttpClient() {BaseAddress = new Uri(baseUrl)};
            var ret = new PlayApi(rc, (m,p) => {
                var rq = new HttpRequestMessage(m, p);
                rq.Headers.Add("Authorization", token);
                return rq;
            });

            return ret;
        }
Beispiel #6
0
        public IObservable<Unit> ConnectToPlay(string baseUrl, string token)
        {
            var client = new HttpClient() {BaseAddress = new Uri(baseUrl)};

            var api = new PlayApi(client, (m,p) => {
                var ret = new HttpRequestMessage(m, p);
                ret.Headers.Add("Authorization", token);
                return ret;
            });

            return api.NowPlaying().Select(_ => Unit.Default);
        }