Exemple #1
0
        public async Task AddReferenceForTypeAsync()
        {
            // Given
            var project = new InMemoryProject();

            // When
            project.AddReferenceFor <InMemoryProject>();
            var compilation = await project.CompileAsync();

            // Then
            Assert.NotNull(compilation);
            Assert.Contains(compilation.ReferencedAssemblyNames, a => a.Name == typeof(InMemoryProject).Assembly.GetName().Name);
        }
Exemple #2
0
        public async Task AddOrUpdateClassAsync()
        {
            // Given
            var project = new InMemoryProject();

            // When
            project.AddOrUpdate("Foo.cs", "public class Foo { }");
            var compilation = await project.CompileAsync();

            // Then
            Assert.NotNull(compilation);
            Assert.True(compilation.ContainsSymbolsWithName("Foo"));
        }