コード例 #1
0
        private string CreateUniqueId()
        {
            var builder = new StringBuilder(base.UniqueId);

            DescriptorUtil.AppendUniqueId(builder, MethodInfo);
            return(builder.ToString());
        }
コード例 #2
0
        public void AppendUniqueId_FromIUniquelyIdentifiable()
        {
            // Arrange
            CustomUniquelyIdentifiable custom = new CustomUniquelyIdentifiable("hello-world");
            StringBuilder builder             = new StringBuilder();

            // Act
            DescriptorUtil.AppendUniqueId(builder, custom);

            // Assert
            Assert.Equal("[11]hello-world", builder.ToString());
        }
コード例 #3
0
        public void AppendUniqueId_FromMemberInfo()
        {
            // Arrange
            string        moduleVersionId = typeof(DescriptorUtilTest).Module.ModuleVersionId.ToString();
            string        metadataToken   = typeof(DescriptorUtilTest).MetadataToken.ToString();
            string        expected        = String.Format("[{0}]{1}[{2}]{3}", moduleVersionId.Length, moduleVersionId, metadataToken.Length, metadataToken);
            StringBuilder builder         = new StringBuilder();

            // Act
            DescriptorUtil.AppendUniqueId(builder, typeof(DescriptorUtilTest));

            // Assert
            Assert.Equal(expected, builder.ToString());
        }