当前位置: 首页>>代码示例>>C#>>正文


C# Scope.ToString方法代码示例

本文整理汇总了C#中Scope.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# Scope.ToString方法的具体用法?C# Scope.ToString怎么用?C# Scope.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Scope的用法示例。


在下文中一共展示了Scope.ToString方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: TestContainer

		public void TestContainer(Format format, string expectedOutput)
		{
			var schema = new Scope();

			schema.Element<Item>()
				.Attributes()
				.Add(x => x.Name)
				.End()
				.Init();

			schema.Element<Container>()
				.Elements()
				.Add(x => x.Items)
				.End()
				.Init();

			var container = new Container(new[] {new Item("a"), new Item("b")});
			var output = schema.ToString(container, format);
			Assert.AreEqual(expectedOutput, output);
			
			var container2 = schema.Parse<Container>(output, format);
			Assert.AreEqual(container.Items.Count, container2.Items.Count);
			Assert.AreEqual(container.Items[0].Name, container2.Items[0].Name);
			Assert.AreEqual(container.Items[1].Name, container2.Items[1].Name);
		}
开发者ID:sergeyt,项目名称:xserializer,代码行数:25,代码来源:ImmutableObjectsTests.cs

示例2: GetScopes_One_Success

		public void GetScopes_One_Success() {
			var expected = new Scope( "some", "random", "scope" );
			var accessTokenMock = new Mock<IAccessToken>();
			MockClaim( accessTokenMock, Constants.Claims.SCOPE, expected.ToString() );
			IEnumerable<Scope> scopes = accessTokenMock.Object.GetScopes();
			Assert.AreEqual( 1, scopes.Count() );
			Assert.AreEqual( expected, scopes.First() );
		}
开发者ID:mpharoah-d2l,项目名称:D2L.Security.OAuth2,代码行数:8,代码来源:AccessTokenExtensionsTests.cs

示例3: ConvertScopeEnum

 /// <summary>
 /// Converts a scope enumeration value into a string representation.
 /// </summary>
 /// <param name="scope">The scope.</param>
 /// <returns>A string value</returns>
 private static string ConvertScopeEnum(Scope scope)
 {
     return scope.ToString().ToLowerInvariant()
         .Replace("read", "read_")
         .Replace("write", "write_")
         .Replace("usage", "usage_")
         .Replace("playmix", "play_mix")
         .Replace("download", "download_")
         .Replace("receive", "receive_");
 }
开发者ID:ni3bobade,项目名称:.net-sdk,代码行数:15,代码来源:ScopeExtensions.cs

示例4: ConvertScopeEnum

 /// <summary>
 /// Converts a scope enumeration value into a string representation.
 /// </summary>
 /// <param name="scope">The scope.</param>
 /// <returns>A string value</returns>
 private static string ConvertScopeEnum(Scope scope)
 {
     // Main work here is to separate the verb from the action...
     return scope.ToString().ToLowerInvariant()
                             .Replace("read", "read_")
                             .Replace("write", "write_")
                             .Replace("usage", "usage_")
                             .Replace("playmix", "play_mix")
                             .Replace("download", "download_")
                             .Replace("receive", "receive_");
 }
开发者ID:hoangtanduy247,项目名称:wp-api-client,代码行数:16,代码来源:AuthScope.cs

示例5: Simple

		public void Simple(Format format, byte[] data, string expectedSerial)
		{
			var schema = new Scope();
			schema.Element<Item>()
				.Elements().Add(x => x.Data);

			var item = new Item {Data = data};
			var serial = schema.ToString(item, format);
			Assert.AreEqual(expectedSerial, serial);

			var item2 = schema.Parse<Item>(serial, format);
			Assert.NotNull(item2);
			Assert.AreEqual(item.Data, item2.Data);
		}
开发者ID:sergeyt,项目名称:xserializer,代码行数:14,代码来源:BlobTests.cs

示例6: JustAttr

		public void JustAttr(Format format, string expectedOutput)
		{
			var schema = new Scope();

			schema.Element<Item>()
				.Attributes()
				.Add(x => x.Name)
				.End()
				.Init();

			var item1 = new Item("test");
			var output = schema.ToString(item1, format);
			Assert.AreEqual(expectedOutput, output);
			
			var item2 = schema.Parse<Item>(output, format);
			Assert.AreEqual(item1.Name, item2.Name);
		}
开发者ID:sergeyt,项目名称:xserializer,代码行数:17,代码来源:ImmutableObjectsTests.cs

示例7: GetConversationsAsync

        public async Task<List<ConversationThread>> GetConversationsAsync(Scope scope, TimeSpan range, CancellationToken cancellationToken)
        {
            await CheckConnectedAsync();

            SearchCondition condition = SearchCondition.Since(DateTime.Now - range);
            string[] uids = await Client.SearchAsync(condition, uid: true);

            List<ConversationThread> conversations = new List<ConversationThread>();
            IList<MailMessage> messages;
            if (uids.Length == 0)
            {
                messages = new MailMessage[0];
            }
            else
            {
                if (scope == Scope.HeadersAndBody || scope == Scope.Headers)
                {
                    // TODO: Consider comma joined list of UIDs
                    messages = await Client.GetMessagesAsync(uids[0], uids[uids.Length - 1], scope);
                }
                else if (scope == Scope.HeadersAndMime)
                {
                    messages = new List<MailMessage>();
                    IList<GmailMessageInfo> infos = await GetMessageIdsAsync(uids);

                    await GetEnvelopeAndStructureAsync(uids,
                        message =>
                        {
                            // Find the matching Ids
                            string messageId = message.GetMessageId();
                            GmailMessageInfo info = infos.First(i => i.MessageId.Equals(messageId));

                            message.SetLabels(info.Labels);
                            message.SetFlags(info.Flags);
                            message.Uid = info.Uid;

                            messages.Add(message);

                            return Task.FromResult(0);
                        },
                        cancellationToken);
                }
                else
                {
                    throw new NotSupportedException(scope.ToString());
                }
            }

            // Group by thread ID
            foreach (IGrouping<string, MailMessage> group in messages.GroupBy(message => message.GetThreadId()))
            {
                ConversationThread conversation = new ConversationThread(group.OrderByDescending(message => message.Date).ToList());
                conversation.Messages.ForEach(message => FixUpLabels(message));
                conversations.Add(conversation);
            }
            return conversations.OrderByDescending(conversation => conversation.LatestDate).ToList();
        }
开发者ID:achingono,项目名称:WinPhoneGmail,代码行数:57,代码来源:GmailImapClient.cs

示例8: GetAuthUrl

 /// <summary>
 /// Creates the reddit OAuth2 Url to redirect the user to for authorization. 
 /// </summary>
 /// <param name="state">Used to verify that the user received is the user that was sent</param>
 /// <param name="scope">Determines what actions can be performed against the user.</param>
 /// <param name="permanent">Set to true for access lasting longer than one hour.</param>
 /// <returns></returns>
 public string GetAuthUrl(string state, Scope scope, bool permanent = false)
 {
     return String.Format("https://ssl.reddit.com/api/v1/authorize?client_id={0}&response_type=code&state={1}&redirect_uri={2}&duration={3}&scope={4}", _clientId, state, _redirectUri, permanent ? "permanent" : "temporary", scope.ToString().Replace(" ",""));
 }
开发者ID:ErokShelf,项目名称:RedditSharp,代码行数:11,代码来源:AuthProvider.cs

示例9: GenerateScope

 public static string GenerateScope(Scope scope, Modifier modifier)
 {
     return string.Format("{0}:{1}", scope.ToString(), modifier.ToString());
 }
开发者ID:cinder14,项目名称:echosign_sdk_csharp,代码行数:4,代码来源:EchoSignOAuth.cs

示例10: GetOauth2Url

 public string GetOauth2Url(string url, Scope scope, string state)
 {
     url = UrlEncode(url);
     string retVal = Oauth2Url + "?appid=" + AppId + "&redirect_uri=" + url + "&response_type=code&scope="+scope.ToString()+"&state="+state+"#wechat_redirect";
     return retVal;
 }
开发者ID:iEasyJob,项目名称:EasyJob,代码行数:6,代码来源:WeiXinPublic.cs

示例11: GetAuthUri

 /// <summary>
 /// Creates the reddit OAuth2 Url to redirect the user to for authorization. 
 /// </summary>
 /// <param name="state">Used to verify that the user received is the user that was sent</param>
 /// <param name="scope">Determines what actions can be performed against the user.</param>
 /// <param name="permanent">Set to true for access lasting longer than one hour.</param>
 /// <returns></returns>
 public Uri GetAuthUri(string state, Scope scope, bool permanent = false)
 {
     var retval = UriService.GetUri(UriService.Endpoints.AuthorizeUri);
     retval = retval.AddParameter("client_id", _clientId);
     retval = retval.AddParameter("response_type", "code");
     retval = retval.AddParameter("state", state);
     retval = retval.AddParameter("redirect_uri", _redirectUri);
     retval = retval.AddParameter("duration", permanent ? "permanent" : "temporary");
     retval = retval.AddParameter("scope", scope.ToString().Replace(" ", "").ToLower());
     return retval;
 }
开发者ID:Erok21,项目名称:RedditSharp,代码行数:18,代码来源:AuthProvider.cs


注:本文中的Scope.ToString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。