diff --git a/src/Microsoft.AspNet.Mvc.Core/DefaultAssemblyProvider.cs b/src/Microsoft.AspNet.Mvc.Core/DefaultAssemblyProvider.cs
index 3320830bf0..5e2eba774b 100644
--- a/src/Microsoft.AspNet.Mvc.Core/DefaultAssemblyProvider.cs
+++ b/src/Microsoft.AspNet.Mvc.Core/DefaultAssemblyProvider.cs
@@ -50,7 +50,7 @@ namespace Microsoft.AspNet.Mvc
{
get
{
- return GetCandidateLibraries().SelectMany(l => l.LoadableAssemblies)
+ return GetCandidateLibraries().SelectMany(l => l.Assemblies)
.Select(Load);
}
}
@@ -60,12 +60,12 @@ namespace Microsoft.AspNet.Mvc
/// By default it returns all assemblies that reference any of the primary MVC assemblies
/// while ignoring MVC assemblies.
///
- /// A set of .
- protected virtual IEnumerable GetCandidateLibraries()
+ /// A set of .
+ protected virtual IEnumerable GetCandidateLibraries()
{
if (ReferenceAssemblies == null)
{
- return Enumerable.Empty();
+ return Enumerable.Empty();
}
// GetReferencingLibraries returns the transitive closure of referencing assemblies
@@ -80,7 +80,7 @@ namespace Microsoft.AspNet.Mvc
return Assembly.Load(assemblyName);
}
- private bool IsCandidateLibrary(ILibraryInformation library)
+ private bool IsCandidateLibrary(Library library)
{
Debug.Assert(ReferenceAssemblies != null);
return !ReferenceAssemblies.Contains(library.Name);
diff --git a/src/Microsoft.AspNet.Mvc.Core/project.json b/src/Microsoft.AspNet.Mvc.Core/project.json
index fcabf2fdac..d2e18b8a92 100644
--- a/src/Microsoft.AspNet.Mvc.Core/project.json
+++ b/src/Microsoft.AspNet.Mvc.Core/project.json
@@ -21,7 +21,7 @@
"Microsoft.Framework.PropertyActivator.Sources": { "version": "1.0.0-*", "type": "build" },
"Microsoft.Framework.PropertyHelper.Sources": { "version": "1.0.0-*", "type": "build" },
"Microsoft.Framework.SecurityHelper.Sources": { "version": "1.0.0-*", "type": "build" },
- "Microsoft.Framework.Runtime.Abstractions": "1.0.0-*",
+ "Microsoft.Framework.Runtime.Compilation.Abstractions": "1.0.0-*",
"Newtonsoft.Json": "6.0.6"
},
"frameworks": {
diff --git a/src/Microsoft.AspNet.Mvc.Razor/Compilation/CompilationFailedException.cs b/src/Microsoft.AspNet.Mvc.Razor/Compilation/CompilationFailedException.cs
index eecb4873e7..7f349a07c4 100644
--- a/src/Microsoft.AspNet.Mvc.Razor/Compilation/CompilationFailedException.cs
+++ b/src/Microsoft.AspNet.Mvc.Razor/Compilation/CompilationFailedException.cs
@@ -4,8 +4,8 @@
using System;
using System.Collections.Generic;
using System.Linq;
-using Microsoft.Framework.Runtime;
using Microsoft.Framework.Internal;
+using Microsoft.Framework.Runtime.Compilation;
namespace Microsoft.AspNet.Mvc.Razor.Compilation
{
@@ -20,16 +20,16 @@ namespace Microsoft.AspNet.Mvc.Razor.Compilation
/// s containing
/// details of the compilation failure.
public CompilationFailedException(
- [NotNull] IEnumerable compilationFailures)
+ [NotNull] IEnumerable compilationFailures)
: base(FormatMessage(compilationFailures))
{
CompilationFailures = compilationFailures;
}
///
- public IEnumerable CompilationFailures { get; }
+ public IEnumerable CompilationFailures { get; }
- private static string FormatMessage(IEnumerable compilationFailures)
+ private static string FormatMessage(IEnumerable compilationFailures)
{
return Resources.CompilationFailed + Environment.NewLine +
string.Join(
diff --git a/src/Microsoft.AspNet.Mvc.Razor/Compilation/CompilationOptionsProviderExtension.cs b/src/Microsoft.AspNet.Mvc.Razor/Compilation/CompilationOptionsProviderExtension.cs
index a4654912b0..30f1448427 100644
--- a/src/Microsoft.AspNet.Mvc.Razor/Compilation/CompilationOptionsProviderExtension.cs
+++ b/src/Microsoft.AspNet.Mvc.Razor/Compilation/CompilationOptionsProviderExtension.cs
@@ -3,6 +3,7 @@
using Microsoft.Framework.Internal;
using Microsoft.Framework.Runtime;
+using Microsoft.Framework.Runtime.Compilation;
using Microsoft.Framework.Runtime.Roslyn;
namespace Microsoft.AspNet.Mvc.Razor.Compilation
diff --git a/src/Microsoft.AspNet.Mvc.Razor/Compilation/CompilationResult.cs b/src/Microsoft.AspNet.Mvc.Razor/Compilation/CompilationResult.cs
index 70548942ff..f06e3b7167 100644
--- a/src/Microsoft.AspNet.Mvc.Razor/Compilation/CompilationResult.cs
+++ b/src/Microsoft.AspNet.Mvc.Razor/Compilation/CompilationResult.cs
@@ -6,6 +6,7 @@ using System.Collections.Generic;
using System.IO;
using Microsoft.Framework.Internal;
using Microsoft.Framework.Runtime;
+using Microsoft.Framework.Runtime.Compilation;
namespace Microsoft.AspNet.Mvc.Razor.Compilation
{
@@ -37,7 +38,7 @@ namespace Microsoft.AspNet.Mvc.Razor.Compilation
///
/// This property is null when compilation succeeded. An empty sequence
/// indicates a failed compilation.
- public IEnumerable CompilationFailures { get; private set; }
+ public IEnumerable CompilationFailures { get; private set; }
///
/// Gets the .
@@ -57,10 +58,10 @@ namespace Microsoft.AspNet.Mvc.Razor.Compilation
///
/// Creates a for a failed compilation.
///
- /// s produced from parsing or
+ /// s produced from parsing or
/// compiling the Razor file.
/// A instance for a failed compilation.
- public static CompilationResult Failed([NotNull] IEnumerable compilationFailures)
+ public static CompilationResult Failed([NotNull] IEnumerable compilationFailures)
{
return new CompilationResult
{
diff --git a/src/Microsoft.AspNet.Mvc.Razor/Compilation/RazorCompilationFailure.cs b/src/Microsoft.AspNet.Mvc.Razor/Compilation/RazorCompilationFailure.cs
deleted file mode 100644
index 2b625880e4..0000000000
--- a/src/Microsoft.AspNet.Mvc.Razor/Compilation/RazorCompilationFailure.cs
+++ /dev/null
@@ -1,42 +0,0 @@
-// Copyright (c) .NET Foundation. All rights reserved.
-// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-
-using System.Collections.Generic;
-using Microsoft.Framework.Runtime;
-using Microsoft.Framework.Internal;
-
-namespace Microsoft.AspNet.Mvc.Razor.Compilation
-{
- ///
- /// for Razor parse failures.
- ///
- public class RazorCompilationFailure : ICompilationFailure
- {
- /// Initializes a new instance of .
- /// The path of the Razor source file that was compiled.
- /// The contents of the Razor source file.
- /// A sequence of encountered
- /// during compilation.
- public RazorCompilationFailure(
- [NotNull] string sourceFilePath,
- [NotNull] string sourceFileContent,
- [NotNull] IEnumerable messages)
- {
- SourceFilePath = sourceFilePath;
- SourceFileContent = sourceFileContent;
- Messages = messages;
- }
-
- ///
- public string SourceFilePath { get; }
-
- ///
- public string SourceFileContent { get; }
-
- ///
- public string CompiledContent { get; } = null;
-
- ///
- public IEnumerable Messages { get; }
- }
-}
\ No newline at end of file
diff --git a/src/Microsoft.AspNet.Mvc.Razor/Compilation/RazorCompilationMessage.cs b/src/Microsoft.AspNet.Mvc.Razor/Compilation/RazorCompilationMessage.cs
deleted file mode 100644
index 8367ce2de4..0000000000
--- a/src/Microsoft.AspNet.Mvc.Razor/Compilation/RazorCompilationMessage.cs
+++ /dev/null
@@ -1,74 +0,0 @@
-// Copyright (c) .NET Foundation. All rights reserved.
-// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-
-using Microsoft.AspNet.Razor;
-using Microsoft.Framework.Internal;
-using Microsoft.Framework.Runtime;
-
-namespace Microsoft.AspNet.Mvc.Razor.Compilation
-{
- ///
- /// for a encountered during parsing.
- ///
- public class RazorCompilationMessage : ICompilationMessage
- {
- ///
- /// Initializes a with the specified message.
- ///
- /// A .
- /// The path of the Razor source file that was parsed.
- public RazorCompilationMessage(
- [NotNull] RazorError razorError,
- string sourceFilePath)
- {
- SourceFilePath = sourceFilePath;
- Message = razorError.Message;
-
- var location = razorError.Location;
- FormattedMessage =
- $"{sourceFilePath} ({location.LineIndex},{location.CharacterIndex}) {razorError.Message}";
-
- StartColumn = location.CharacterIndex;
- StartLine = location.LineIndex + 1;
- EndColumn = location.CharacterIndex + razorError.Length;
- EndLine = location.LineIndex + 1;
- }
-
- ///
- /// Gets a message produced from compilation.
- ///
- public string Message { get; }
-
- ///
- public int StartColumn { get; }
-
- ///
- public int StartLine { get; }
-
- ///
- public int EndColumn { get; }
-
- ///
- public int EndLine { get; }
-
- ///
- public string SourceFilePath { get; }
-
- ///
- public string FormattedMessage { get; }
-
- ///
- // All Razor diagnostics are errors
- public CompilationMessageSeverity Severity { get; } = CompilationMessageSeverity.Error;
-
- ///
- /// Returns a representation of this instance of .
- ///
- /// A representing this instance.
- /// Returns same value as .
- public override string ToString()
- {
- return FormattedMessage;
- }
- }
-}
diff --git a/src/Microsoft.AspNet.Mvc.Razor/Compilation/RazorCompilationService.cs b/src/Microsoft.AspNet.Mvc.Razor/Compilation/RazorCompilationService.cs
index 15dc5a57d7..3448ffe035 100644
--- a/src/Microsoft.AspNet.Mvc.Razor/Compilation/RazorCompilationService.cs
+++ b/src/Microsoft.AspNet.Mvc.Razor/Compilation/RazorCompilationService.cs
@@ -10,6 +10,8 @@ using Microsoft.AspNet.Razor;
using Microsoft.AspNet.Razor.CodeGenerators;
using Microsoft.Framework.Internal;
using Microsoft.Framework.OptionsModel;
+using Microsoft.Framework.Runtime;
+using Microsoft.Framework.Runtime.Compilation;
namespace Microsoft.AspNet.Mvc.Razor.Compilation
{
@@ -82,21 +84,34 @@ namespace Microsoft.AspNet.Mvc.Razor.Compilation
razorError.Location.FilePath ?? file.RelativePath,
StringComparer.Ordinal);
- var failures = new List();
+ var failures = new List();
foreach (var group in messageGroups)
{
var filePath = group.Key;
var fileContent = ReadFileContentsSafely(filePath);
- var compilationFailure = new RazorCompilationFailure(
+ var compilationFailure = new CompilationFailure(
filePath,
fileContent,
- group.Select(parserError => new RazorCompilationMessage(parserError, filePath)));
+ group.Select(parserError => CreateDiagnosticMessage(parserError, filePath)));
failures.Add(compilationFailure);
}
return CompilationResult.Failed(failures);
}
+ private DiagnosticMessage CreateDiagnosticMessage(RazorError error, string filePath)
+ {
+ return new DiagnosticMessage(
+ error.Message,
+ $"{error} ({error.Location.LineIndex},{error.Location.CharacterIndex}) {error.Message}",
+ filePath,
+ DiagnosticMessageSeverity.Error,
+ error.Location.LineIndex + 1,
+ error.Location.CharacterIndex,
+ error.Location.LineIndex + 1,
+ error.Location.CharacterIndex + error.Length);
+ }
+
private string ReadFileContentsSafely(string relativePath)
{
var fileInfo = _fileProvider.GetFileInfo(relativePath);
diff --git a/src/Microsoft.AspNet.Mvc.Razor/Compilation/RoslynCompilationService.cs b/src/Microsoft.AspNet.Mvc.Razor/Compilation/RoslynCompilationService.cs
index 97e5f779b7..a9f91b19c0 100644
--- a/src/Microsoft.AspNet.Mvc.Razor/Compilation/RoslynCompilationService.cs
+++ b/src/Microsoft.AspNet.Mvc.Razor/Compilation/RoslynCompilationService.cs
@@ -31,7 +31,7 @@ namespace Microsoft.AspNet.Mvc.Razor.Compilation
private readonly ConcurrentDictionary _metadataFileCache =
new ConcurrentDictionary(StringComparer.OrdinalIgnoreCase);
- private readonly ILibraryManager _libraryManager;
+ private readonly ILibraryExporter _libraryExporter;
private readonly IApplicationEnvironment _environment;
private readonly IAssemblyLoadContext _loader;
private readonly ICompilerOptionsProvider _compilerOptionsProvider;
@@ -53,14 +53,14 @@ namespace Microsoft.AspNet.Mvc.Razor.Compilation
/// The that was used to generate the code.
public RoslynCompilationService(IApplicationEnvironment environment,
IAssemblyLoadContextAccessor loaderAccessor,
- ILibraryManager libraryManager,
+ ILibraryExporter libraryExporter,
ICompilerOptionsProvider compilerOptionsProvider,
IMvcRazorHost host,
IOptions optionsAccessor)
{
_environment = environment;
_loader = loaderAccessor.GetLoadContext(typeof(RoslynCompilationService).GetTypeInfo().Assembly);
- _libraryManager = libraryManager;
+ _libraryExporter = libraryExporter;
_applicationReferences = new Lazy>(GetApplicationReferences);
_compilerOptionsProvider = compilerOptionsProvider;
_fileProvider = optionsAccessor.Options.FileProvider;
@@ -141,7 +141,7 @@ namespace Microsoft.AspNet.Mvc.Razor.Compilation
.Where(IsError)
.GroupBy(diagnostic => GetFilePath(relativePath, diagnostic), StringComparer.Ordinal);
- var failures = new List();
+ var failures = new List();
foreach (var group in diagnosticGroups)
{
var sourceFilePath = group.Key;
@@ -157,12 +157,7 @@ namespace Microsoft.AspNet.Mvc.Razor.Compilation
sourceFileContent = ReadFileContentsSafely(_fileProvider, sourceFilePath);
}
- var compilationFailure = new RoslynCompilationFailure(group)
- {
- CompiledContent = compilationContent,
- SourceFileContent = sourceFileContent,
- SourceFilePath = sourceFilePath
- };
+ var compilationFailure = new CompilationFailure(sourceFilePath, sourceFileContent, compilationContent, group.Select(d => d.ToDiagnosticMessage(_environment.RuntimeFramework)));
failures.Add(compilationFailure);
}
@@ -187,7 +182,7 @@ namespace Microsoft.AspNet.Mvc.Razor.Compilation
// Get the MetadataReference for the executing application. If it's a Roslyn reference,
// we can copy the references created when compiling the application to the Razor page being compiled.
// This avoids performing expensive calls to MetadataReference.CreateFromImage.
- var libraryExport = _libraryManager.GetLibraryExport(_environment.ApplicationName);
+ var libraryExport = _libraryExporter.GetLibraryExport(_environment.ApplicationName);
if (libraryExport?.MetadataReferences != null && libraryExport.MetadataReferences.Count > 0)
{
Debug.Assert(libraryExport.MetadataReferences.Count == 1,
@@ -202,7 +197,7 @@ namespace Microsoft.AspNet.Mvc.Razor.Compilation
}
}
- var export = _libraryManager.GetAllExports(_environment.ApplicationName);
+ var export = _libraryExporter.GetAllExports(_environment.ApplicationName);
foreach (var metadataReference in export.MetadataReferences)
{
// Taken from https://github.com/aspnet/KRuntime/blob/757ba9bfdf80bd6277e715d6375969a7f44370ee/src/...
diff --git a/src/Microsoft.AspNet.Mvc/RazorPreCompileModule.cs b/src/Microsoft.AspNet.Mvc/RazorPreCompileModule.cs
index 7305ef875b..1bbfff427c 100644
--- a/src/Microsoft.AspNet.Mvc/RazorPreCompileModule.cs
+++ b/src/Microsoft.AspNet.Mvc/RazorPreCompileModule.cs
@@ -7,6 +7,7 @@ using Microsoft.AspNet.Mvc.Razor.Precompilation;
using Microsoft.Framework.Caching.Memory;
using Microsoft.Framework.DependencyInjection;
using Microsoft.Framework.Runtime;
+using Microsoft.Framework.Runtime.Compilation;
using Microsoft.Framework.Runtime.Roslyn;
namespace Microsoft.AspNet.Mvc
diff --git a/test/Microsoft.AspNet.Mvc.Core.Test/DefaultAssemblyProviderTests.cs b/test/Microsoft.AspNet.Mvc.Core.Test/DefaultAssemblyProviderTests.cs
index 96b968732a..07aa5fb777 100644
--- a/test/Microsoft.AspNet.Mvc.Core.Test/DefaultAssemblyProviderTests.cs
+++ b/test/Microsoft.AspNet.Mvc.Core.Test/DefaultAssemblyProviderTests.cs
@@ -22,10 +22,10 @@ namespace Microsoft.AspNet.Mvc.Core
manager.Setup(f => f.GetReferencingLibraries(It.IsAny()))
.Returns(new[]
{
- CreateLibraryInfo("Microsoft.AspNet.Mvc.Core"),
- CreateLibraryInfo("Microsoft.AspNet.Mvc"),
- CreateLibraryInfo("Microsoft.AspNet.Mvc.Abstractions"),
- CreateLibraryInfo("SomeRandomAssembly"),
+ new Library("Microsoft.AspNet.Mvc.Core"),
+ new Library("Microsoft.AspNet.Mvc"),
+ new Library("Microsoft.AspNet.Mvc.Abstractions"),
+ new Library("SomeRandomAssembly"),
})
.Verifiable();
var provider = new TestAssemblyProvider(manager.Object);
@@ -45,13 +45,13 @@ namespace Microsoft.AspNet.Mvc.Core
// Arrange
var manager = new Mock();
manager.Setup(f => f.GetReferencingLibraries(It.IsAny()))
- .Returns(Enumerable.Empty());
+ .Returns(Enumerable.Empty());
manager.Setup(f => f.GetReferencingLibraries("Microsoft.AspNet.Mvc.Core"))
- .Returns(new[] { CreateLibraryInfo("Foo") });
+ .Returns(new[] { new Library("Foo") });
manager.Setup(f => f.GetReferencingLibraries("Microsoft.AspNet.Mvc.Abstractions"))
- .Returns(new[] { CreateLibraryInfo("Bar") });
+ .Returns(new[] { new Library("Bar") });
manager.Setup(f => f.GetReferencingLibraries("Microsoft.AspNet.Mvc"))
- .Returns(new[] { CreateLibraryInfo("Baz") });
+ .Returns(new[] { new Library("Baz") });
var provider = new TestAssemblyProvider(manager.Object);
// Act
@@ -118,30 +118,23 @@ namespace Microsoft.AspNet.Mvc.Core
Assert.True(expected.SetEquals(referenceAssemblies));
}
- private static ILibraryInformation CreateLibraryInfo(string name)
- {
- var info = new Mock();
- info.SetupGet(b => b.Name).Returns(name);
- return info.Object;
- }
-
private static ILibraryManager CreateLibraryManager()
{
var manager = new Mock();
manager.Setup(f => f.GetReferencingLibraries(It.IsAny()))
- .Returns(Enumerable.Empty());
+ .Returns(Enumerable.Empty());
manager.Setup(f => f.GetReferencingLibraries("Microsoft.AspNet.Mvc.Core"))
- .Returns(new[] { CreateLibraryInfo("Baz") });
+ .Returns(new[] { new Library("Baz") });
manager.Setup(f => f.GetReferencingLibraries("MyAssembly"))
- .Returns(new[] { CreateLibraryInfo("Foo") });
+ .Returns(new[] { new Library("Foo") });
manager.Setup(f => f.GetReferencingLibraries("AnotherAssembly"))
- .Returns(new[] { CreateLibraryInfo("Bar") });
+ .Returns(new[] { new Library("Bar") });
return manager.Object;
}
private class TestAssemblyProvider : DefaultAssemblyProvider
{
- public new IEnumerable GetCandidateLibraries()
+ public new IEnumerable GetCandidateLibraries()
{
return base.GetCandidateLibraries();
}
@@ -202,7 +195,7 @@ namespace Microsoft.AspNet.Mvc.Core
return new HashSet(
SelectMvcAssemblies(
- GetLoadableAssemblies(dependencies)));
+ GetAssemblies(dependencies)));
}
}
@@ -249,11 +242,11 @@ namespace Microsoft.AspNet.Mvc.Core
return mvcAssemblies;
}
- private static IEnumerable GetLoadableAssemblies(IEnumerable libraries)
+ private static IEnumerable GetAssemblies(IEnumerable libraries)
{
return libraries
.Select(n => _libraryManager.GetLibraryInformation(n))
- .SelectMany(n => n.LoadableAssemblies)
+ .SelectMany(n => n.Assemblies)
.Distinct()
.Select(n => n.Name);
}
diff --git a/test/Microsoft.AspNet.Mvc.FunctionalTests/ControllerDiscoveryConventionTests.cs b/test/Microsoft.AspNet.Mvc.FunctionalTests/ControllerDiscoveryConventionTests.cs
index 36d97d5957..a8ddb0eaea 100644
--- a/test/Microsoft.AspNet.Mvc.FunctionalTests/ControllerDiscoveryConventionTests.cs
+++ b/test/Microsoft.AspNet.Mvc.FunctionalTests/ControllerDiscoveryConventionTests.cs
@@ -132,7 +132,7 @@ namespace Microsoft.AspNet.Mvc.FunctionalTests
}
- protected override IEnumerable GetCandidateLibraries()
+ protected override IEnumerable GetCandidateLibraries()
{
var libraries = base.GetCandidateLibraries();
// Filter out other WebSite projects
diff --git a/test/Microsoft.AspNet.Mvc.FunctionalTests/TestApplicationEnvironment.cs b/test/Microsoft.AspNet.Mvc.FunctionalTests/TestApplicationEnvironment.cs
index aaf9d78c54..fda5f3abc8 100644
--- a/test/Microsoft.AspNet.Mvc.FunctionalTests/TestApplicationEnvironment.cs
+++ b/test/Microsoft.AspNet.Mvc.FunctionalTests/TestApplicationEnvironment.cs
@@ -28,9 +28,9 @@ namespace Microsoft.AspNet.Mvc.FunctionalTests
get { return _applicationName; }
}
- public string Version
+ public string ApplicationVersion
{
- get { return _originalAppEnvironment.Version; }
+ get { return _originalAppEnvironment.ApplicationVersion; }
}
public string ApplicationBasePath
diff --git a/test/Microsoft.AspNet.Mvc.Razor.Test/Compilation/CompilationResultTest.cs b/test/Microsoft.AspNet.Mvc.Razor.Test/Compilation/CompilationResultTest.cs
index e6b60ecf6b..c16c6b96a6 100644
--- a/test/Microsoft.AspNet.Mvc.Razor.Test/Compilation/CompilationResultTest.cs
+++ b/test/Microsoft.AspNet.Mvc.Razor.Test/Compilation/CompilationResultTest.cs
@@ -1,7 +1,9 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
+using System.Linq;
using Microsoft.Framework.Runtime;
+using Microsoft.Framework.Runtime.Compilation;
using Moq;
using Xunit;
@@ -13,7 +15,7 @@ namespace Microsoft.AspNet.Mvc.Razor.Compilation
public void EnsureSuccessful_ThrowsIfCompilationFailed()
{
// Arrange
- var compilationFailure = Mock.Of();
+ var compilationFailure = new CompilationFailure("test", Enumerable.Empty());
var failures = new[] { compilationFailure };
var result = CompilationResult.Failed(failures);
diff --git a/test/Microsoft.AspNet.Mvc.Razor.Test/Compilation/RoslynCompilationServiceTest.cs b/test/Microsoft.AspNet.Mvc.Razor.Test/Compilation/RoslynCompilationServiceTest.cs
index 7cf7176239..7e5a9aad99 100644
--- a/test/Microsoft.AspNet.Mvc.Razor.Test/Compilation/RoslynCompilationServiceTest.cs
+++ b/test/Microsoft.AspNet.Mvc.Razor.Test/Compilation/RoslynCompilationServiceTest.cs
@@ -26,7 +26,7 @@ namespace Microsoft.AspNet.Mvc.Razor.Compilation
public class MyTestType {}";
var applicationEnvironment = GetApplicationEnvironment();
var accessor = GetLoadContextAccessor();
- var libraryManager = GetLibraryManager();
+ var libraryExporter = GetLibraryExporter();
var compilerOptionsProvider = new Mock();
compilerOptionsProvider.Setup(p => p.GetCompilerOptions(applicationEnvironment.ApplicationName,
@@ -39,7 +39,7 @@ public class MyTestType {}";
var compilationService = new RoslynCompilationService(applicationEnvironment,
accessor,
- libraryManager,
+ libraryExporter,
compilerOptionsProvider.Object,
mvcRazorHost.Object,
GetOptions());
@@ -66,7 +66,7 @@ public class MyTestType {}";
this should fail";
var applicationEnvironment = GetApplicationEnvironment();
var accessor = GetLoadContextAccessor();
- var libraryManager = GetLibraryManager();
+ var libraryExporter = GetLibraryExporter();
var compilerOptionsProvider = new Mock();
compilerOptionsProvider.Setup(p => p.GetCompilerOptions(applicationEnvironment.ApplicationName,
@@ -79,7 +79,7 @@ this should fail";
var compilationService = new RoslynCompilationService(applicationEnvironment,
accessor,
- libraryManager,
+ libraryExporter,
compilerOptionsProvider.Object,
mvcRazorHost,
GetOptions(fileProvider));
@@ -104,7 +104,7 @@ this should fail";
var content = @"this should fail";
var applicationEnvironment = GetApplicationEnvironment();
var accessor = GetLoadContextAccessor();
- var libraryManager = GetLibraryManager();
+ var libraryExporter = GetLibraryExporter();
var compilerOptionsProvider = new Mock();
compilerOptionsProvider.Setup(p => p.GetCompilerOptions(applicationEnvironment.ApplicationName,
@@ -115,7 +115,7 @@ this should fail";
var compilationService = new RoslynCompilationService(applicationEnvironment,
accessor,
- libraryManager,
+ libraryExporter,
compilerOptionsProvider.Object,
mvcRazorHost,
GetOptions());
@@ -144,7 +144,7 @@ this should fail";
this should fail";
var applicationEnvironment = GetApplicationEnvironment();
var accessor = GetLoadContextAccessor();
- var libraryManager = GetLibraryManager();
+ var libraryExporter = GetLibraryExporter();
var compilerOptionsProvider = new Mock();
compilerOptionsProvider.Setup(p => p.GetCompilerOptions(applicationEnvironment.ApplicationName,
@@ -161,7 +161,7 @@ this should fail";
var compilationService = new RoslynCompilationService(applicationEnvironment,
accessor,
- libraryManager,
+ libraryExporter,
compilerOptionsProvider.Object,
mvcRazorHost,
GetOptions(fileProvider));
@@ -192,7 +192,7 @@ public class MyNonCustomDefinedClass {}
";
var applicationEnvironment = GetApplicationEnvironment();
var accessor = GetLoadContextAccessor();
- var libraryManager = GetLibraryManager();
+ var libraryExporter = GetLibraryExporter();
var compilerOptionsProvider = new Mock();
compilerOptionsProvider.Setup(p => p.GetCompilerOptions(applicationEnvironment.ApplicationName,
@@ -205,7 +205,7 @@ public class MyNonCustomDefinedClass {}
var compilationService = new RoslynCompilationService(applicationEnvironment,
accessor,
- libraryManager,
+ libraryExporter,
compilerOptionsProvider.Object,
mvcRazorHost.Object,
GetOptions());
@@ -229,7 +229,7 @@ public class RazorPrefixType {}
public class NotRazorPrefixType {}";
var applicationEnvironment = GetApplicationEnvironment();
var accessor = GetLoadContextAccessor();
- var libraryManager = GetLibraryManager();
+ var libraryExporter = GetLibraryExporter();
var compilerOptionsProvider = new Mock();
compilerOptionsProvider.Setup(p => p.GetCompilerOptions(applicationEnvironment.ApplicationName,
@@ -242,7 +242,7 @@ public class NotRazorPrefixType {}";
var compilationService = new RoslynCompilationService(applicationEnvironment,
accessor,
- libraryManager,
+ libraryExporter,
compilerOptionsProvider.Object,
mvcRazorHost.Object,
GetOptions());
@@ -275,7 +275,7 @@ public class NotRazorPrefixType {}";
var compilationService = new RoslynCompilationService(
GetApplicationEnvironment(),
GetLoadContextAccessor(),
- GetLibraryManager(),
+ GetLibraryExporter(),
Mock.Of(),
Mock.Of(),
options.Object);
@@ -365,21 +365,17 @@ public class NotRazorPrefixType {}";
isEnabledByDefault: true);
}
- private static ILibraryManager GetLibraryManager()
+ private static ILibraryExporter GetLibraryExporter()
{
var fileReference = new Mock();
fileReference.SetupGet(f => f.Path)
.Returns(typeof(string).Assembly.Location);
- var libraryExport = new Mock();
- libraryExport.SetupGet(e => e.MetadataReferences)
- .Returns(new[] { fileReference.Object });
- libraryExport.SetupGet(e => e.SourceReferences)
- .Returns(new ISourceReference[0]);
+ var libraryExport = new LibraryExport(fileReference.Object);
- var libraryManager = new Mock();
- libraryManager.Setup(l => l.GetAllExports(It.IsAny()))
- .Returns(libraryExport.Object);
- return libraryManager.Object;
+ var libraryExporter = new Mock();
+ libraryExporter.Setup(l => l.GetAllExports(It.IsAny()))
+ .Returns(libraryExport);
+ return libraryExporter.Object;
}
private static IAssemblyLoadContextAccessor GetLoadContextAccessor()