예제 #1
0
        private static void PopulateTestMethodMetadata(IMethodInfo methodInfo, MSTest methodTest)
        {
            IEnumerable <IAttributeInfo> attributes = methodInfo.GetAttributeInfos(null, true);

            foreach (IAttributeInfo attribute in attributes)
            {
                switch (attribute.Type.FullName)
                {
                case MSTestAttributes.AspNetDevelopmentServerAttribute:
                    methodTest.Metadata.Add(MSTestMetadataKeys.AspNetDevelopmentServer, GetAspNetDevelopmentServer(attribute));
                    break;

                case MSTestAttributes.AspNetDevelopmentServerHostAttribute:
                    methodTest.Metadata.Add(MSTestMetadataKeys.AspNetDevelopmentServerHost, GetAspNetDevelopmentServerHost(attribute));
                    break;

                case MSTestAttributes.CredentialAttribute:
                    methodTest.Metadata.Add(MSTestMetadataKeys.Credential, GetCredential(attribute));
                    break;

                case MSTestAttributes.CssIterationAttribute:
                    methodTest.Metadata.Add(MSTestMetadataKeys.CssIteration, GetAttributePropertyValue(attribute, MSTestMetadataKeys.CssIteration));
                    break;

                case MSTestAttributes.CssProjectStructureAttribute:
                    methodTest.Metadata.Add(MSTestMetadataKeys.CssProjectStructure, GetAttributePropertyValue(attribute, MSTestMetadataKeys.CssProjectStructure));
                    break;

                case MSTestAttributes.DeploymentItemAttribute:
                    AddDeploymentItem(attribute, methodTest);
                    break;

                case MSTestAttributes.DataSourceAttribute:
                    methodTest.Metadata.Add(MSTestMetadataKeys.DataSource, GetDatasource(attribute));
                    break;

                case MSTestAttributes.DescriptionAttribute:
                    methodTest.Metadata.Add(MetadataKeys.Description, GetAttributePropertyValue(attribute, MetadataKeys.Description));
                    break;

                case MSTestAttributes.HostTypeAttribute:
                    methodTest.Metadata.Add(MSTestMetadataKeys.HostType, GetHostType(attribute));
                    break;

                case MSTestAttributes.IgnoreAttribute:
                    methodTest.Metadata.Add(MetadataKeys.IgnoreReason, Resources.MSTestExplorer_IgnoreAttributeWasAppliedToTest);
                    break;

                case MSTestAttributes.OwnerAttribute:
                    methodTest.Metadata.Add(MSTestMetadataKeys.Owner, GetAttributePropertyValue(attribute, MSTestMetadataKeys.Owner));
                    break;

                case MSTestAttributes.PriorityAttribute:
                    methodTest.Metadata.Add(MSTestMetadataKeys.Priority, GetAttributePropertyValue(attribute, MSTestMetadataKeys.Priority));
                    break;

                case MSTestAttributes.TestPropertyAttribute:
                    AddTestProperty(attribute, methodTest);
                    break;

                case MSTestAttributes.TimeoutAttribute:
                    methodTest.Metadata.Add(MSTestMetadataKeys.Timeout, GetAttributePropertyValue(attribute, MSTestMetadataKeys.Timeout));
                    break;

                case MSTestAttributes.UrlToTestAttribute:
                    methodTest.Metadata.Add(MSTestMetadataKeys.UrlToTest, GetAttributePropertyValue(attribute, MSTestMetadataKeys.UrlToTest));
                    break;

                case MSTestAttributes.WorkItemAttribute:
                    methodTest.Metadata.Add(MSTestMetadataKeys.WorkItem, GetAttributePropertyValue(attribute, "Id"));
                    break;

                default:
                    break;
                }
            }
        }
예제 #2
0
 private static void PopulateTestMethodMetadata(IMethodInfo methodInfo, MSTest methodTest)
 {
     IEnumerable<IAttributeInfo> attributes = methodInfo.GetAttributeInfos(null, true);
     foreach (IAttributeInfo attribute in attributes)
     {
         switch (attribute.Type.FullName)
         {
             case MSTestAttributes.AspNetDevelopmentServerAttribute:
                 methodTest.Metadata.Add(MSTestMetadataKeys.AspNetDevelopmentServer, GetAspNetDevelopmentServer(attribute));
                 break;
             case MSTestAttributes.AspNetDevelopmentServerHostAttribute:
                 methodTest.Metadata.Add(MSTestMetadataKeys.AspNetDevelopmentServerHost, GetAspNetDevelopmentServerHost(attribute));
                 break;
             case MSTestAttributes.CredentialAttribute:
                 methodTest.Metadata.Add(MSTestMetadataKeys.Credential, GetCredential(attribute));
                 break;
             case MSTestAttributes.CssIterationAttribute:
                 methodTest.Metadata.Add(MSTestMetadataKeys.CssIteration, GetAttributePropertyValue(attribute, MSTestMetadataKeys.CssIteration));
                 break;
             case MSTestAttributes.CssProjectStructureAttribute:
                 methodTest.Metadata.Add(MSTestMetadataKeys.CssProjectStructure, GetAttributePropertyValue(attribute, MSTestMetadataKeys.CssProjectStructure));
                 break;
             case MSTestAttributes.DeploymentItemAttribute:
                 AddDeploymentItem(attribute, methodTest);
                 break;
             case MSTestAttributes.DataSourceAttribute:
                 methodTest.Metadata.Add(MSTestMetadataKeys.DataSource, GetDatasource(attribute));
                 break;
             case MSTestAttributes.DescriptionAttribute:
                 methodTest.Metadata.Add(MetadataKeys.Description, GetAttributePropertyValue(attribute, MetadataKeys.Description));
                 break;
             case MSTestAttributes.HostTypeAttribute:
                 methodTest.Metadata.Add(MSTestMetadataKeys.HostType, GetHostType(attribute));
                 break;
             case MSTestAttributes.IgnoreAttribute:
                 methodTest.Metadata.Add(MetadataKeys.IgnoreReason, Resources.MSTestExplorer_IgnoreAttributeWasAppliedToTest);
                 break;
             case MSTestAttributes.OwnerAttribute:
                 methodTest.Metadata.Add(MSTestMetadataKeys.Owner, GetAttributePropertyValue(attribute, MSTestMetadataKeys.Owner));
                 break;
             case MSTestAttributes.PriorityAttribute:
                 methodTest.Metadata.Add(MSTestMetadataKeys.Priority, GetAttributePropertyValue(attribute, MSTestMetadataKeys.Priority));
                 break;
             case MSTestAttributes.TestPropertyAttribute:
                 AddTestProperty(attribute, methodTest);
                 break;
             case MSTestAttributes.TimeoutAttribute:
                 methodTest.Metadata.Add(MSTestMetadataKeys.Timeout, GetAttributePropertyValue(attribute, MSTestMetadataKeys.Timeout));
                 break;
             case MSTestAttributes.UrlToTestAttribute:
                 methodTest.Metadata.Add(MSTestMetadataKeys.UrlToTest, GetAttributePropertyValue(attribute, MSTestMetadataKeys.UrlToTest));
                 break;
             case MSTestAttributes.WorkItemAttribute:
                 methodTest.Metadata.Add(MSTestMetadataKeys.WorkItem, GetAttributePropertyValue(attribute, "Id"));
                 break;
             default:
                 break;
         }
     }
 }