本文整理汇总了C#中MusicClient类的典型用法代码示例。如果您正苦于以下问题:C# MusicClient类的具体用法?C# MusicClient怎么用?C# MusicClient使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MusicClient类属于命名空间,在下文中一共展示了MusicClient类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: EnsureAsyncGetTopProductsReturnsItems
public async void EnsureAsyncGetTopProductsReturnsItems()
{
// Only test happy path, as the MusicClient tests cover the unhappy path
IMusicClient client = new MusicClient("test", "gb", new MockApiRequestHandler(Resources.product_parse_tests));
ListResponse<Product> result = await client.GetTopProductsAsync(Category.Album);
Assert.Greater(result.Result.Count, 0, "Expected more than 0 results");
}
示例2: EnsureGetArtistsAroundLocationReturnsArtistsForValidSearch
public void EnsureGetArtistsAroundLocationReturnsArtistsForValidSearch()
{
IMusicClient client = new MusicClient("test", "test", "gb", new MockApiRequestHandler(Resources.search_artists));
client.GetArtistsAroundLocation(
(ListResponse<Artist> result) =>
{
Assert.IsNotNull(result, "Expected a result");
Assert.IsNotNull(result.StatusCode, "Expected a status code");
Assert.IsTrue(result.StatusCode.HasValue, "Expected a status code");
Assert.AreEqual(HttpStatusCode.OK, result.StatusCode.Value, "Expected a 200 response");
Assert.IsNotNull(result.Result, "Expected a list of results");
Assert.IsNull(result.Error, "Expected no error");
Assert.Greater(result.Result.Count, 0, "Expected more than 0 results");
foreach (Artist artist in result.Result)
{
Assert.IsFalse(string.IsNullOrEmpty(artist.Id), "Expected Id to be populated");
Assert.IsFalse(string.IsNullOrEmpty(artist.Name), "Expected Name to be populated");
Assert.IsNotNull(artist.Genres, "Expected a genre list");
Assert.Greater(artist.Genres.Length, 0, "Expected more than 0 genres");
}
},
51.45534,
-2.59239);
}
示例3: EnsureExceptionIsThrownIfNullProductAsync
public void EnsureExceptionIsThrownIfNullProductAsync()
{
IMusicClient client = new MusicClient("test", "gb", new MockApiRequestHandler(Resources.product_parse_tests));
Product nullProduct = null;
var t = client.GetSimilarProductsAsync(nullProduct);
t.Wait();
}
示例4: EnsureAuthTokenSetCorrectly
public void EnsureAuthTokenSetCorrectly()
{
var client = new MusicClient("test", "gb", new MockApiRequestHandler(FakeResponse.NotFound()));
client.SetAuthenticationToken(AuthTokenTests.GetTestAuthToken());
Assert.AreEqual(true, client.IsUserAuthenticated, "Expected an authenticated user");
Assert.AreEqual(true, client.IsUserTokenActive, "Expected an authenticated user");
}
示例5: ActivityViewModel
public ActivityViewModel (MusicClient client, AuthHelper authHelper)
{
this._mixRadioClient = client;
this._authHelper = authHelper;
this.Artists = new ObservableCollection<Artist> ();
this.Tracks = new ObservableCollection<UserEvent> ();
}
示例6: EnsureAsyncGetProductsReturnsItems
public void EnsureAsyncGetProductsReturnsItems()
{
// Only test happy path, as the MusicClient tests cover the unhappy path
IMusicClient client = new MusicClient("test", "gb", new MockApiRequestHandler(Resources.single_product));
var task = client.GetProductAsync("test");
task.Wait();
this.ValidateProductResponse(task.Result);
}
示例7: EnsureAsyncGetGenresReturnsItems
public async void EnsureAsyncGetGenresReturnsItems()
{
// Only test happy path, as the MusicClient tests cover the unhappy path
IMusicClient client = new MusicClient("test", "gb", new MockApiRequestHandler(Resources.genres));
ListResponse<Genre> result = await client.GetGenresAsync();
Assert.Greater(result.Result.Count, 0, "Expected more than 0 results");
}
示例8: EnsureRefreshAuthenticationTokenAsyncReturnsExistingTokenIfValid
public async Task EnsureRefreshAuthenticationTokenAsyncReturnsExistingTokenIfValid()
{
var client = new MusicClient("test", "gb", new MockApiRequestHandler(FakeResponse.NotFound()));
var token = AuthTokenTests.GetTestAuthToken();
client.SetAuthenticationToken(token);
var result = await client.RefreshAuthenticationTokenAsync("secret");
Assert.AreEqual(token.AccessToken, result.AccessToken, "Expected the same token");
}
示例9: EnsureGetArtistProductsReturnsItems
public async Task EnsureGetArtistProductsReturnsItems()
{
IMusicClient client = new MusicClient("test", "gb", new MockApiRequestHandler(Resources.search_artists));
var t = await client.GetArtistProductsAsync("test", Category.Album);
this.ValidateProductListResponse(t);
t = await client.GetArtistProductsAsync("test");
this.ValidateProductListResponse(t);
}
示例10: EnsureRequestIdComesBackInResponse
public async Task EnsureRequestIdComesBackInResponse()
{
IMusicClient client = new MusicClient("test", "gb", new MockApiRequestHandler(Resources.search_suggestions));
var requestId = Guid.NewGuid();
ListResponse<string> result = await client.GetSearchSuggestionsAsync("green", requestId: requestId);
Assert.IsNotNull(result, "Expected a result");
Assert.AreEqual(requestId, result.RequestId);
}
示例11: FindTest3
public async Task FindTest3()
{
var client = new MusicClient("XboxMusicClientTests", "ThisWillBeChangedOften");
var result = await client.Find("caparezza non me lo posso promettere");
Assert.IsNotNull(result);
Assert.IsNotNull(result.Error);
Assert.IsNotNull(result.Error.Response);
Assert.AreEqual("NotFound", result.Error.ErrorCode);
}
示例12: App
public App(IAuthPlatformSpecific platformSpecificAuth, string appVersion, IUriLauncher uriLauncher)
{
this.MixRadioClient = new MusicClient (ApiKeys.ClientId);
this.AuthHelper = new AuthHelper (platformSpecificAuth, this.MixRadioClient);
this.ActivityViewModel = new ActivityViewModel (this.MixRadioClient, this.AuthHelper);
this.AppVersion = appVersion;
this.UriLauncher = uriLauncher;
this.MainPage = new RootPage ();
}
示例13: EnsureGetArtistProductsReturnsItems
public void EnsureGetArtistProductsReturnsItems()
{
IMusicClient client = new MusicClient("test", "gb", new MockApiRequestHandler(Resources.search_artists));
var task = client.GetArtistProductsAsync(new Artist() { Id = "test" }, Category.Album);
task.Wait();
this.ValidateProductListResponse(task.Result);
task = client.GetArtistProductsAsync("test");
task.Wait();
this.ValidateProductListResponse(task.Result);
}
示例14: GetTest1
public async Task GetTest1()
{
var client = new MusicClient("XboxMusicClientTests", "ThisWillBeChangedOften");
var result = await client.Get("music.C61C0000-0200-11DB-89CA-0019B92A3933");
Assert.IsNotNull(result);
Assert.IsNull(result.Error);
Assert.IsNotNull(result.Artists);
//Assert.IsNotNull(result.Tracks);
//Assert.IsNotNull(result.Albums);
}
示例15: FindTest2
public async Task FindTest2()
{
var client = new MusicClient("XboxMusicClientTests", "ThisWillBeChangedOften");
var result = await client.Find("Daft Punk", getAlbums: false);
Assert.IsNotNull(result);
Assert.IsNull(result.Error);
Assert.IsNotNull(result.Artists);
Assert.IsNotNull(result.Tracks);
Assert.IsNull(result.Albums);
}