protected void RunAuthoringBufferElementDataTest(Type type)
        {
            TypeDefinition authoringType =
                AuthoringComponentPostProcessor.CreateBufferElementDataAuthoringType(TypeDefinitionFor(type));

            RunTest(authoringType);
        }
        protected void RunTest(Type type)
        {
            var componentTypeDefinition = TypeDefinitionFor(type);
            var authoringType           = AuthoringComponentPostProcessor.CreateAuthoringType(componentTypeDefinition);

            RunTest(authoringType);
        }
        protected override void AssertProducesInternal(Type systemType, DiagnosticType expectedDiagnosticType, string[] errorIdentifiers, bool useFailResolver = false)
        {
            DiagnosticMessage error = null;

            try
            {
                AuthoringComponentPostProcessor.CreateBufferElementDataAuthoringType(TypeDefinitionFor(systemType));
            }
            catch (FoundErrorInUserCodeException exception)
            {
                error = exception.DiagnosticMessages.Single();
            }

            Assert.AreEqual(expected: expectedDiagnosticType, actual: error?.DiagnosticType);
            Assert.IsTrue(error?.MessageData.Contains(errorIdentifiers.Single()));
        }
Exemple #4
0
        protected override void AssertProducesInternal(
            Type systemType,
            DiagnosticType expectedDiagnosticType,
            string[] errorIdentifiers,
            bool useFailResolver = false)
        {
            DiagnosticMessage error = null;

            try
            {
                AssemblyDefinition assemblyDefinition   = AssemblyDefinition.ReadAssembly(systemType.Assembly.Location);
                TypeDefinition     typeDefinitionToTest = assemblyDefinition.MainModule.Types.Single(t => t.Name == systemType.Name);

                bool _ = AuthoringComponentPostProcessor.RunTest(typeDefinitionToTest);
            }
            catch (FoundErrorInUserCodeException exception)
            {
                error = exception.DiagnosticMessages.Single();
            }
            Assert.AreEqual(expected: expectedDiagnosticType, actual: error?.DiagnosticType);
            Assert.IsTrue(error?.MessageData.Contains(errorIdentifiers.Single()));
        }