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


C# UniqueId.ToString方法代码示例

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


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

示例1: MatchesKeyIdentifierClause

		public void MatchesKeyIdentifierClause ()
		{
			UniqueId id = new UniqueId ();
			X509SecurityToken t = new X509SecurityToken (cert, id.ToString ());
			LocalIdKeyIdentifierClause l =
				new LocalIdKeyIdentifierClause (id.ToString ());
			Assert.IsTrue (t.MatchesKeyIdentifierClause (l), "#1-1");

			l = new LocalIdKeyIdentifierClause ("#" + id.ToString ());
			Assert.IsFalse (t.MatchesKeyIdentifierClause (l), "#1-2");

			X509ThumbprintKeyIdentifierClause h =
				new X509ThumbprintKeyIdentifierClause (cert);
			Assert.IsTrue (t.MatchesKeyIdentifierClause (h), "#2-1");

			h = new X509ThumbprintKeyIdentifierClause (cert2);
			Assert.IsFalse (t.MatchesKeyIdentifierClause (h), "#2-2");

			X509IssuerSerialKeyIdentifierClause i =
				new X509IssuerSerialKeyIdentifierClause (cert);
			Assert.IsTrue (t.MatchesKeyIdentifierClause (i), "#3-1");

			i = new X509IssuerSerialKeyIdentifierClause (cert2);
			Assert.IsFalse (t.MatchesKeyIdentifierClause (i), "#3-2");

			X509RawDataKeyIdentifierClause s =
				new X509RawDataKeyIdentifierClause (cert);
			Assert.IsTrue (t.MatchesKeyIdentifierClause (s), "#4-1");

			s = new X509RawDataKeyIdentifierClause (cert2);
			Assert.IsFalse (t.MatchesKeyIdentifierClause (s), "#4-2");
		}
开发者ID:nlhepler,项目名称:mono,代码行数:32,代码来源:X509SecurityTokenTest.cs

示例2: DefaultValues

		public void DefaultValues ()
		{
			UniqueId id = new UniqueId ();
			X509SecurityToken t = new X509SecurityToken (cert, id.ToString ());
			Assert.AreEqual (id.ToString (), t.Id, "#1");
			Assert.AreEqual (cert, t.Certificate, "#2");
			Assert.AreEqual (cert.NotBefore.ToUniversalTime (), t.ValidFrom, "#3");
			Assert.AreEqual (cert.NotAfter.ToUniversalTime (), t.ValidTo, "#4");
			Assert.AreEqual (1, t.SecurityKeys.Count, "#5");
		}
开发者ID:nlhepler,项目名称:mono,代码行数:10,代码来源:X509SecurityTokenTest.cs

示例3: DefaultValues

		public void DefaultValues ()
		{
			UniqueId id = new UniqueId ();
			UserNameSecurityToken t = new UserNameSecurityToken ("mono", "poly", id.ToString ());
			Assert.AreEqual (id.ToString (), t.Id, "#1");
			Assert.AreEqual ("mono", t.UserName, "#2");
			Assert.AreEqual ("poly", t.Password,"#3");
			Assert.IsTrue (DateTime.Today.ToUniversalTime () <= t.ValidFrom && DateTime.Now.ToUniversalTime () >= t.ValidFrom, "#4");
			Assert.AreEqual (DateTime.MaxValue.AddDays (-1), t.ValidTo, "#5");
			Assert.AreEqual (0, t.SecurityKeys.Count, "#6");
		}
开发者ID:nlhepler,项目名称:mono,代码行数:11,代码来源:UserNameSecurityTokenTest.cs

示例4: ProvideUrnFromHeaderFields

        private Guid ProvideUrnFromHeaderFields(UniqueId headerField)
        {
            var urn = new Guid();

            if (headerField != null)
            {
                var possibleUrnAsString = StripFormattingFromHeaderFields(headerField.ToString());
                Guid.TryParseExact(possibleUrnAsString, "D", out urn);
            }
            return urn;
        }
开发者ID:JimInWA,项目名称:tracing-and-logging,代码行数:11,代码来源:Helper.cs

示例5: Send

 public override void Send(Message message, TimeSpan timeout)
 {
     // add the message id if not
     var messageId = new System.Xml.UniqueId();
     if (message.Headers.MessageId == null)
     {
         message.Headers.MessageId = messageId;
     }
     // send message with session id
     var content = GetStringFromWcfMessage(message, RemoteAddress);
     _bus.SendRequest(content, _session.Id, true, ChannelID, null);
     // wait for the acknowledge message from the server side
     _bus.Receive(false, messageId.ToString());
 }
开发者ID:shaunxu,项目名称:roma,代码行数:14,代码来源:MessageBusOutputSessionChannel.cs

示例6: TestDefault

		public void TestDefault ()
		{
			UniqueId id = new UniqueId ();
			Assert.IsTrue (id.IsGuid, "#1");

			Guid g = Guid.NewGuid ();

			UniqueId a = new UniqueId (g);
			UniqueId b = new UniqueId (g.ToByteArray ());

			Assert.AreEqual (a, b, "#2");
			Assert.AreEqual ("urn:uuid:", a.ToString ().Substring (0, 9), "#3");

			a = new UniqueId ("foo");
			Assert.AreEqual ("foo", a.ToString (), "#4");
		}
开发者ID:nlhepler,项目名称:mono,代码行数:16,代码来源:UniqueIdTest.cs

示例7: Logger_Log_Success

        public void Logger_Log_Success()
        {
            // Arrange
            const string methodName = "Logger_Log_Success";
            var uniqueId = new UniqueId(Urn);
            var messageTextJustInnerXmlOfBody = File.ReadAllText(LoggerSampleRequestJustInnerXmlOfBodyFullPath);
            var messageTextFull = File.ReadAllText(LoggerSampleRequestFullPath).Replace("Method_Name", methodName).Replace("urn:uuid:00000000-0000-0000-0000-000000000000", uniqueId.ToString());
            var xmlReader = XmlReader.Create(new StringReader(messageTextJustInnerXmlOfBody));

            const string sourceType = "WCF Server Side";
            const string incomingRequestText = "incoming request";
            var result = false;

            // Create the Message
            var expectedMessage = Message.CreateMessage(MessageVersion.Soap11WSAddressing10, methodName, xmlReader);

            // Because this is the incoming request, set MessageId
            expectedMessage.Headers.MessageId = uniqueId;

            // Act
            try
            {
                result = LoggerForTests.Log(sourceType, incomingRequestText, Urn, expectedMessage);
            }
            catch (Exception ex)
            {
                Assert.Fail("{0}", ex);
            }

            Assert.IsTrue(result, "Log method returned false");

            // if you want to inspect the value logged in the table, stop the test at this point

            var applicationName = TestHelperForTests.GetAppSettingsKey("SoapRequestsAndResponsesApplicationName");
            const bool isRequest = true;
            const bool isResponse = false;
            var sqlSelectStatement = TestHelperForTests.BuildSqlSelectStatement(applicationName, isRequest, isResponse, Urn, methodName, messageTextFull);
            const int expectedRowCount = 1;
            var rowIdValue = TestHelperForTests.ExecuteSqlSelectStatement(sqlSelectStatement, expectedRowCount);
            var sqlDeleteStatement = TestHelperForTests.BuildSqlDeleteStatement(rowIdValue);
            TestHelperForTests.ExecuteSqlDeleteStatement(sqlDeleteStatement, expectedRowCount);
        }
开发者ID:JimInWA,项目名称:tracing-and-logging,代码行数:42,代码来源:LoggerTest.cs

示例8: DebugMessageDispatcher_AfterReceiveRequest_Success

        public void DebugMessageDispatcher_AfterReceiveRequest_Success()
        {
            // Arrange
            const string methodName = "DebugMessageDispatcher_AfterReceiveRequest_Success";
            var uniqueId = new UniqueId(Urn);
            IClientChannel channel = null;
            InstanceContext context = null;
            var messageTextJustInnerXmlOfBody = File.ReadAllText(DispatcherSampleRequestJustInnerXmlOfBodyFullPath);
            var messageTextFull = File.ReadAllText(DispatcherSampleRequestFullPath).Replace("Method_Name", methodName).Replace("urn:uuid:00000000-0000-0000-0000-000000000000", uniqueId.ToString());
            var xmlReader = XmlReader.Create(new StringReader(messageTextJustInnerXmlOfBody));

            // Create the Message
            var expectedMessage = Message.CreateMessage(MessageVersion.Soap11WSAddressing10, methodName, xmlReader);

            // Because this is the incoming request, set MessageId
            expectedMessage.Headers.MessageId = uniqueId;

            // Act
            try
            {
                // Note: If the SoapRequestsAndResponsesShouldLog in test project App.config is true, then the value should be logged to the DB
                // However, since we are using TPL (Task Parallel Library) Task.Factory.StartNew, the below call will finish before the item is
                // actually logged to the DB
                var actualMessage = DebugMessageDispatcherForTests.AfterReceiveRequest(ref expectedMessage, channel, context);
            }
            catch (Exception ex)
            {
                Assert.Fail("{0}", ex);
            }

            // if you want to inspect the value logged in the table, stop the test at this point

            var applicationName = TestHelperForTests.GetAppSettingsKey("SoapRequestsAndResponsesApplicationName");
            const bool isRequest = true;
            const bool isResponse = false;
            var sqlSelectStatement = TestHelperForTests.BuildSqlSelectStatement(applicationName, isRequest, isResponse, Urn, methodName, messageTextFull);
            const int expectedRowCount = 1;
            var rowIdValue = TestHelperForTests.ExecuteSqlSelectStatement(sqlSelectStatement, expectedRowCount);
            var sqlDeleteStatement = TestHelperForTests.BuildSqlDeleteStatement(rowIdValue);
            TestHelperForTests.ExecuteSqlDeleteStatement(sqlDeleteStatement, expectedRowCount);
        }
开发者ID:JimInWA,项目名称:tracing-and-logging,代码行数:41,代码来源:DebugMessageDispatcherTest.cs

示例9: DebugMessageInspector_AfterReceiveReply_Success

        public void DebugMessageInspector_AfterReceiveReply_Success()
        {
            // Arrange
            const string methodName = "DebugMessageInspector_AfterReceiveReply_Success";
            var uniqueId = new UniqueId(Urn);
            var messageTextJustInnerXmlOfBody = File.ReadAllText(InspectorSampleReplyJustInnerXmlOfBodyFullPath);
            var messageTextFull = File.ReadAllText(InspectorSampleReplyFullPath).Replace("Method_Name", methodName).Replace("urn:uuid:00000000-0000-0000-0000-000000000000", uniqueId.ToString());
            var xmlReader = XmlReader.Create(new StringReader(messageTextJustInnerXmlOfBody));

            // Create the Message
            var expectedMessage = Message.CreateMessage(MessageVersion.Default, methodName, xmlReader);

            // Because this is the incoming reply, set RelatesTo
            expectedMessage.Headers.RelatesTo = uniqueId;

            // Act
            object myCorrelationState = null;
            try
            {
                // Note: If the SoapRequestsAndResponsesShouldLog in App.config is true, then the value should be logged to the DB
                DebugMessageInspectorForTests.AfterReceiveReply(ref expectedMessage, myCorrelationState);
            }
            catch (Exception ex)
            {
                Assert.Fail("{0}", ex);
            }

            // if you want to inspect the value logged in the table, stop the test at this point

            var applicationName = TestHelperForTests.GetAppSettingsKey("SoapRequestsAndResponsesApplicationName");
            const bool isRequest = false;
            const bool isResponse = true;
            var sqlSelectStatement = TestHelperForTests.BuildSqlSelectStatement(applicationName, isRequest, isResponse, Urn, methodName, messageTextFull);
            const int expectedRowCount = 1;
            var rowIdValue = TestHelperForTests.ExecuteSqlSelectStatement(sqlSelectStatement, expectedRowCount);
            var sqlDeleteStatement = TestHelperForTests.BuildSqlDeleteStatement(rowIdValue);
            TestHelperForTests.ExecuteSqlDeleteStatement(sqlDeleteStatement, expectedRowCount);
        }
开发者ID:JimInWA,项目名称:tracing-and-logging,代码行数:38,代码来源:DebugMessageInspectorTest.cs

示例10: ToString

 static public string ToString(UniqueId value) { return value.ToString(); }
开发者ID:geoffkizer,项目名称:corefx,代码行数:1,代码来源:XmlConverter.cs

示例11: WriteValue

 public virtual void WriteValue(UniqueId value)
 {
     if (value == null)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("value");
     }
     this.WriteString(value.ToString());
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:8,代码来源:XmlDictionaryWriter.cs

示例12: WriteUniqueIdText

 public override void WriteUniqueIdText(UniqueId value)
 {
     if (value.IsGuid)
     {
         int charCount = value.CharArrayLength;
         char[] chars = GetCharBuffer(charCount);
         value.ToCharArray(chars, 0);
         WriteText(chars, 0, charCount);
     }
     else
     {
         WriteEscapedText(value.ToString());
     }
 }
开发者ID:rendle-labs,项目名称:corefx,代码行数:14,代码来源:XmlUTF8TextWriter.cs

示例13: WriteValue

		public virtual void WriteValue (UniqueId id)
		{
			if (id == null)
				throw new ArgumentNullException ("id");
			WriteString (id.ToString ());
		}
开发者ID:nlhepler,项目名称:mono,代码行数:6,代码来源:XmlDictionaryWriter.cs

示例14: WriteValue

        public virtual void WriteValue(UniqueId value)
        {
            if (value == null)
                throw System.Runtime.Serialization.DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("value");

            WriteString(value.ToString());
        }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:7,代码来源:XmlDictionaryWriter.cs

示例15: WriteValue

		public override void WriteValue (UniqueId value)
		{
			if (value == null)
				throw new ArgumentNullException ("value");

			Guid guid;
			if (value.TryGetGuid (out guid)) {
				// this conditional branching is required for
				// attr_typed_value not being true.
				ProcessTypedValue ();

				writer.Write (BF.UniqueId);
				byte [] bytes = guid.ToByteArray ();
				writer.Write (bytes, 0, bytes.Length);
			} else {
				WriteValue (value.ToString ());
			}
		}
开发者ID:calumjiao,项目名称:Mono-Class-Libraries,代码行数:18,代码来源:XmlBinaryDictionaryWriter.cs


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