1. Cloud development

試験

日本語翻訳に関する免責事項

このページの翻訳はAIによって自動的に行われました。可能な限り正確な翻訳を心掛けていますが、原文と異なる表現や解釈が含まれる場合があります。正確で公式な情報については、必ず英語の原文をご参照ください。

Fluent SDKは、開発者がCHインスタンスを更新し、テスト結果を確認するためのより良い方法を提供します。

Web Client SDKを通じたFluent SDKテストライブラリの使用

  • Web Client SDKの「開始」手順に従ってNuGetフィードの設定を行います
  • プロジェクトに Stylelabs.M.Sdk.Fluent.Testing パッケージへの参照を追加してください

以下の例は、新しいM.Tagエンティティを作成し、保存後にエンティティのプロパティを主張します

var endpoint = new Uri("https://your.m.endpoint.com"); var oath = new OAuthPasswordGrant { ClientId = "client_id", ClientSecret = "client_secret", UserName = "username", Password = "password" };

var fluentClient = new FluentClient(MClientFactory.CreateMClient(endpoint, oauth));

var culture = new CultureInfo("en-US"); var name = "A.Tag"; var label = "Tag Label"; var synonyms = "Tag 1, Tag 2, Tag 3";

var newTag = fluentClient.EntityFactory.Create("M.Tag") .SetPropertyValue("TagName", name) .SetPropertyValue("TagLabel", culture, label) .SetPropertyValue("Synonyms", culture, synonyms) .Save();

fluentClient.Entities.Get(newTag.Id.Value) .AssertPropertyEqual("TagName", name) .AssertPropertyEqual("TagLabel", culture, label) .AssertPropertyEqual("Synonyms", culture, synonyms);

以下の例では、子関係を持つ新しいM.Tagエンティティを作成し、保存後にそのエンティティの関係を主張します

var endpoint = new Uri("https://your.m.endpoint.com"); var oath = new OAuthPasswordGrant { ClientId = "client_id", ClientSecret = "client_secret", UserName = "username", Password = "password" };

var fluentClient = new FluentClient(MClientFactory.CreateMClient(endpoint, oauth));

var culture = new CultureInfo("en-US");

var parentTag = fluentClient.EntityFactory.Create("M.Tag") .SetPropertyValue("TagName", "IntegrationTest.TestParentTag1") .SetPropertyValue("TagLabel", culture, "Test Parent Label") .Save();

var childTag = fluentClient.EntityFactory.Create("M.Tag") .SetPropertyValue("TagName", "IntegrationTest.TestChildTag1") .SetPropertyValue("TagLabel", culture, "Test Child Label") .Save();

parentTag .Children( "TagToSelf", relation = relation.Children.Add(childTag.Id.Value)) .Save();

parentTag.AssertRelation("TagToSelf", RelationRole.Parent, childTag);

より詳細な ウォークスルー

この記事を改善するための提案がある場合は、 お知らせください!