本文整理汇总了C#中MusicClient类的典型用法代码示例。如果您正苦于以下问题:C# MusicClient类的具体用法?C# MusicClient怎么用?C# MusicClient使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MusicClient类属于命名空间,在下文中一共展示了MusicClient类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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");
}
开发者ID:NaveenSelvaraj,项目名称:wp-api-client,代码行数:7,代码来源:ProductChartTests.cs
示例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);
}
开发者ID:maxdenisov,项目名称:wp-api-client,代码行数:25,代码来源:SearchArtistByLocationTests.cs
示例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();
}
开发者ID:NaveenSelvaraj,项目名称:wp-api-client,代码行数:7,代码来源:SimilarProductsTests.cs
示例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");
}
开发者ID:ni3bobade,项目名称:.net-sdk,代码行数:7,代码来源:UserAuthTests.cs
示例5: ActivityViewModel
public ActivityViewModel (MusicClient client, AuthHelper authHelper)
{
this._mixRadioClient = client;
this._authHelper = authHelper;
this.Artists = new ObservableCollection<Artist> ();
this.Tracks = new ObservableCollection<UserEvent> ();
}
开发者ID:ni3bobade,项目名称:.net-sdk,代码行数:7,代码来源:ActivityViewModel.cs
示例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);
}
开发者ID:NaveenSelvaraj,项目名称:wp-api-client,代码行数:8,代码来源:GetProductTests.cs
示例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");
}
开发者ID:NaveenSelvaraj,项目名称:wp-api-client,代码行数:8,代码来源:GenreTests.cs
示例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");
}
开发者ID:ni3bobade,项目名称:.net-sdk,代码行数:8,代码来源:UserAuthTests.cs
示例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);
}
开发者ID:ni3bobade,项目名称:.net-sdk,代码行数:8,代码来源:ArtistProductTests.cs
示例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);
}
开发者ID:hoangtanduy247,项目名称:wp-api-client,代码行数:9,代码来源:SearchSuggestionsTests.cs
示例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);
}
开发者ID:haroldma,项目名称:Xbox.Music,代码行数:9,代码来源:MusicClientTests.cs
示例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 ();
}
开发者ID:ni3bobade,项目名称:.net-sdk,代码行数:9,代码来源:App.cs
示例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);
}
开发者ID:hoangtanduy247,项目名称:wp-api-client,代码行数:10,代码来源:ArtistProductTests.cs
示例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);
}
开发者ID:haroldma,项目名称:Xbox.Music,代码行数:10,代码来源:MusicClientTests.cs
示例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);
}
开发者ID:haroldma,项目名称:Xbox.Music,代码行数:10,代码来源:MusicClientTests.cs
示例16: FindTest1Continued
public async Task FindTest1Continued()
{
var client = new MusicClient("XboxMusicClientTests", "ThisWillBeChangedOften");
var result = await client.Find("Daft Punk", _find1ContinuationToken);
Assert.IsNotNull(result);
Assert.IsNull(result.Error);
Assert.IsNotNull(result.Albums);
Assert.IsNull(result.Artists);
Assert.IsNull(result.Tracks);
}
开发者ID:haroldma,项目名称:Xbox.Music,代码行数:10,代码来源:MusicClientTests.cs
示例17: EnsureAsyncGetArtistProductsReturnsItems
public void EnsureAsyncGetArtistProductsReturnsItems()
{
// Only test happy path, as the MusicClient tests cover the unhappy path
IMusicClient client = new MusicClient("test", "gb", new MockApiRequestHandler(Resources.artist_products));
var artistProductByIdTask = client.GetArtistProductsAsync("test");
var artistProductByArtistTask = client.GetArtistProductsAsync(new Artist() { Id = "test" });
artistProductByIdTask.Wait();
artistProductByArtistTask.Wait();
this.ValidateProductListResponse(artistProductByIdTask.Result);
this.ValidateProductListResponse(artistProductByArtistTask.Result);
}
开发者ID:NaveenSelvaraj,项目名称:wp-api-client,代码行数:11,代码来源:ArtistProductTests.cs
示例18: EnsureGetNewReleasesReturnsErrorForFailedCall
public async Task EnsureGetNewReleasesReturnsErrorForFailedCall()
{
IMusicClient client = new MusicClient("test", "gb", new MockApiRequestHandler(FakeResponse.NotFound()));
ListResponse<Product> result = await client.GetNewReleasesAsync(Category.Album);
Assert.IsNotNull(result, "Expected a result");
Assert.IsNotNull(result.StatusCode, "Expected a status code");
Assert.IsTrue(result.StatusCode.HasValue, "Expected a status code");
Assert.AreNotEqual(HttpStatusCode.OK, result.StatusCode.Value, "Expected a non-OK response");
Assert.IsNotNull(result.Error, "Expected an error");
Assert.AreEqual(typeof(ApiCallFailedException), result.Error.GetType(), "Expected an ApiCallFailedException");
}
开发者ID:ni3bobade,项目名称:.net-sdk,代码行数:11,代码来源:ProductNewReleasesTests.cs
示例19: EnsureGetProductReturnsUnknownErrorForFailedCall
public async Task EnsureGetProductReturnsUnknownErrorForFailedCall()
{
IMusicClient client = new MusicClient("test", "gb", new MockApiRequestHandler(FakeResponse.ConflictServerError("{ \"error\":\"true\"}")));
Response<Product> result = await client.GetProductAsync("test");
Assert.IsNotNull(result, "Expected a result");
Assert.IsNotNull(result.StatusCode, "Expected a status code");
Assert.IsTrue(result.StatusCode.HasValue, "Expected a status code");
Assert.AreNotEqual(HttpStatusCode.OK, result.StatusCode.Value, "Expected a non-OK response");
Assert.IsNotNull(result.Error, "Expected an error");
Assert.AreEqual(typeof(ApiCallFailedException), result.Error.GetType(), "Expected an ApiCallFailedException");
}
开发者ID:hoangtanduy247,项目名称:wp-api-client,代码行数:11,代码来源:GetProductTests.cs
示例20: EnsureGetGenresReturnsErrorForFailedCall
public async Task EnsureGetGenresReturnsErrorForFailedCall()
{
IMusicClient client = new MusicClient("test", "gb", new MockApiRequestHandler(FakeResponse.InternalServerError()));
var result = await client.GetGenresAsync();
Assert.IsNotNull(result, "Expected a result");
Assert.IsNotNull(result.StatusCode, "Expected a status code");
Assert.IsTrue(result.StatusCode.HasValue, "Expected a status code");
Assert.AreNotEqual(HttpStatusCode.OK, result.StatusCode.Value, "Expected a non-OK response");
Assert.IsNotNull(result.Error, "Expected an error");
Assert.AreEqual(typeof(ApiCallFailedException), result.Error.GetType(), "Expected an ApiCallFailedException");
}
开发者ID:ni3bobade,项目名称:.net-sdk,代码行数:11,代码来源:GenreTests.cs
注:本文中的MusicClient类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论