public void CreateClassifiedDescription_SingleDescription_NoSeparator()
        {
            // Arrange
            var factory     = new DefaultVisualStudioDescriptionFactory();
            var description = new AggregateBoundAttributeDescription(new[]
            {
                new BoundAttributeDescriptionInfo("TheReturnType", "TheTypeName", "ThePropertyName", "The documentation"),
            });

            // Act
            var result = factory.CreateClassifiedDescription(description);

            // Assert
            Assert.DoesNotContain(DefaultVisualStudioDescriptionFactory.SeparatorElement, result.Elements);
        }
예제 #2
0
        public void CreateClassifiedDescription_MultipleDescription_Separator()
        {
            // Arrange
            var factory     = new DefaultVisualStudioDescriptionFactory();
            var description = new AttributeCompletionDescription(new[]
            {
                new AttributeDescriptionInfo("TheReturnType", "TheTypeName", "ThePropertyName", "The documentation"),
                new AttributeDescriptionInfo("TheReturnType2", "TheTypeName2", "ThePropertyName2", "The documentation2"),
            });

            // Act
            var result = factory.CreateClassifiedDescription(description);

            // Assert
            Assert.Contains(DefaultVisualStudioDescriptionFactory.SeparatorElement, result.Elements);
        }
        public void CreateClassifiedDescription_RepresentsPropertyName()
        {
            // Arrange
            var factory     = new DefaultVisualStudioDescriptionFactory();
            var description = new AggregateBoundAttributeDescription(new[]
            {
                new BoundAttributeDescriptionInfo("TheReturnType", "TheTypeName", "ThePropertyName", "The documentation"),
            });

            // Act
            var result = factory.CreateClassifiedDescription(description);

            // Assert
            var flattened = FlattenToStrings(result);

            Assert.Contains(description.DescriptionInfos[0].PropertyName, flattened);
        }
        public void CreateClassifiedDescription_CanSimplifyKeywordReturnTypes()
        {
            // Arrange
            var factory     = new DefaultVisualStudioDescriptionFactory();
            var description = new AggregateBoundAttributeDescription(new[]
            {
                new BoundAttributeDescriptionInfo("System.String", "TheTypeName", "ThePropertyName", "The documentation"),
            });

            // Act
            var result = factory.CreateClassifiedDescription(description);

            // Assert
            var flattened = FlattenToStrings(result);

            Assert.DoesNotContain(description.DescriptionInfos[0].ReturnTypeName, flattened);
            Assert.Contains("string", flattened);
        }
        public void CreateClassifiedDescription_CanRepresentMultipleDescriptions()
        {
            // Arrange
            var factory     = new DefaultVisualStudioDescriptionFactory();
            var description = new AggregateBoundAttributeDescription(new[]
            {
                new BoundAttributeDescriptionInfo("System.String", "TheTypeName", "ThePropertyName", "The documentation"),
                new BoundAttributeDescriptionInfo("System.Int32", "TheSecondTypeName", "TheSecondPropertyName", "The second documentation"),
            });

            // Act
            var result = factory.CreateClassifiedDescription(description);

            // Assert
            var flattened = FlattenToStrings(result);

            Assert.Contains(description.DescriptionInfos[0].TypeName, flattened);
            Assert.Contains(description.DescriptionInfos[1].TypeName, flattened);
            Assert.Contains(description.DescriptionInfos[0].Documentation, flattened);
            Assert.Contains(description.DescriptionInfos[1].Documentation, flattened);
        }