Example #1
0
            public void when_no_state_definition_found_does_not_throw()
            {
                var otherComp = AppCompilation
                                .RemoveSyntaxTrees(AppCompilation.SyntaxTrees.AsEnumerable())
                                .AddSyntaxTrees(SyntaxFactory.ParseSyntaxTree(""));
                var otherSut = new ProcessAnalysisService();
                ProcessDefinition definition = null;

                Assert.DoesNotThrow(() => definition = otherSut.GetProcessDefinition(otherComp));
                Assert.Null(definition);
            }
Example #2
0
            public given_a_compiled_application()
            {
                //var resourceType = typeof (Resources);
                //var assemblies = resourceType.GetProperties(BindingFlags.Static | BindingFlags.Public)
                //    .Select(y => y.GetValue(null, null))
                //    .OfType<byte[]>()
                //    .ToList();

                //Assert.NotEmpty(assemblies);

                //Assert.True(assemblies.Count == 7); // # of assemblies in resource file
                AppCompilation = CSharpCompilation.Create("test")
                                 .AddSyntaxTrees(SyntaxFactory.ParseSyntaxTree(infraCode))
                                 .AddSyntaxTrees(SyntaxFactory.ParseSyntaxTree(code))
                                 .AddReferences(new MetadataFileReference(typeof(object).Assembly.Location))
                                 .AddReferences(new MetadataFileReference(typeof(IEnumerable <>).Assembly.Location));
                //  .AddReferences(assemblies.Select(x => new AssemblyBytesReference(x)));

                var diag = AppCompilation.GetDiagnostics().Where(d => d.Severity >= DiagnosticSeverity.Warning);

                Assert.Empty(diag);

                sut = new ProcessAnalysisService();
            }