Remove csv reader
This commit is contained in:
parent
665dc9bcce
commit
6970a75746
8 changed files with 57 additions and 304 deletions
|
@ -10,7 +10,7 @@ using Moq;
|
|||
using Xunit;
|
||||
using FluentAssertions;
|
||||
|
||||
namespace StreamForwarderTests
|
||||
namespace Microsoft.Extensions.DependencyModel.Tests
|
||||
{
|
||||
public class CompositeResolverTests
|
||||
{
|
||||
|
@ -55,14 +55,7 @@ namespace StreamForwarderTests
|
|||
failTwo.Object
|
||||
};
|
||||
|
||||
var library = new CompilationLibrary(
|
||||
string.Empty,
|
||||
string.Empty,
|
||||
string.Empty,
|
||||
string.Empty,
|
||||
Enumerable.Empty<string>(),
|
||||
Enumerable.Empty<Dependency>(),
|
||||
false);
|
||||
var library = TestLibraryFactory.Create();
|
||||
|
||||
var resolver = new CompositeCompilationAssemblyResolver(resolvers);
|
||||
var result = resolver.TryResolveAssemblyPaths(library, null);
|
||||
|
@ -90,14 +83,7 @@ namespace StreamForwarderTests
|
|||
};
|
||||
|
||||
var assemblies = new List<string>();
|
||||
var library = new CompilationLibrary(
|
||||
string.Empty,
|
||||
string.Empty,
|
||||
string.Empty,
|
||||
string.Empty,
|
||||
Enumerable.Empty<string>(),
|
||||
Enumerable.Empty<Dependency>(),
|
||||
false);
|
||||
var library = TestLibraryFactory.Create();
|
||||
|
||||
var resolver = new CompositeCompilationAssemblyResolver(resolvers);
|
||||
var result = resolver.TryResolveAssemblyPaths(library, assemblies);
|
||||
|
|
|
@ -1,94 +0,0 @@
|
|||
// Copyright (c) .NET Foundation and contributors. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using System.Text;
|
||||
using Microsoft.Extensions.DependencyModel;
|
||||
using FluentAssertions;
|
||||
using Xunit;
|
||||
|
||||
namespace Microsoft.Extensions.DependencyModel.Tests
|
||||
{
|
||||
public class DependencyContextCsvReaderTests
|
||||
{
|
||||
private DependencyContext Read(string text)
|
||||
{
|
||||
using (var stream = new MemoryStream(Encoding.UTF8.GetBytes(text)))
|
||||
{
|
||||
return new DependencyContextCsvReader().Read(stream);
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void GroupsAssetsCorrectlyIntoLibraries()
|
||||
{
|
||||
var context = Read(@"
|
||||
""Package"",""runtime.any.System.AppContext"",""4.1.0-rc2-23811"",""sha512-1"",""runtime"",""System.AppContext"",""lib\\dnxcore50\\System.AppContext.dll""
|
||||
""Package"",""runtime.any.System.AppContext"",""4.1.0-rc2-23811"",""sha512-1"",""runtime"",""System.AppContext"",""lib\\dnxcore50\\System.Runtime.dll""
|
||||
");
|
||||
context.RuntimeLibraries.Should().HaveCount(1);
|
||||
var library = context.RuntimeLibraries.Single();
|
||||
library.Type.Should().Be("Package");
|
||||
library.Name.Should().Be("runtime.any.System.AppContext");
|
||||
library.Version.Should().Be("4.1.0-rc2-23811");
|
||||
library.Hash.Should().Be("sha512-1");
|
||||
library.Assemblies.Should().HaveCount(2).And
|
||||
.Contain(a => a.Path == "lib\\dnxcore50\\System.AppContext.dll").And
|
||||
.Contain(a => a.Path == "lib\\dnxcore50\\System.Runtime.dll");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void IgnoresAllButRuntimeAssets()
|
||||
{
|
||||
var context = Read(@"
|
||||
""Package"",""runtime.any.System.AppContext"",""4.1.0-rc2-23811"",""sha512-1"",""runtime"",""System.AppContext"",""lib\\dnxcore50\\System.AppContext.dll""
|
||||
""Package"",""runtime.any.System.AppContext"",""4.1.0-rc2-23811"",""sha512-1"",""native"",""System.AppContext"",""lib\\dnxcore50\\System.AppContext2.so""
|
||||
");
|
||||
context.RuntimeLibraries.Should().HaveCount(1);
|
||||
var library = context.RuntimeLibraries.Single();
|
||||
library.Assemblies.Should().HaveCount(1).And
|
||||
.Contain(a => a.Path == "lib\\dnxcore50\\System.AppContext.dll");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void IgnoresNiDllAssemblies()
|
||||
{
|
||||
var context = Read(@"
|
||||
""Package"",""runtime.any.System.AppContext"",""4.1.0-rc2-23811"",""sha512-1"",""runtime"",""System.AppContext"",""lib\\dnxcore50\\System.AppContext.dll""
|
||||
""Package"",""runtime.any.System.AppContext"",""4.1.0-rc2-23811"",""sha512-1"",""runtime"",""System.AppContext"",""lib\\dnxcore50\\System.AppContext.ni.dll""
|
||||
");
|
||||
context.RuntimeLibraries.Should().HaveCount(1);
|
||||
var library = context.RuntimeLibraries.Single();
|
||||
library.Assemblies.Should().HaveCount(1).And
|
||||
.Contain(a => a.Path == "lib\\dnxcore50\\System.AppContext.dll");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void UsesTypeNameVersionAndHashToGroup()
|
||||
{
|
||||
var context = Read(@"
|
||||
""Package"",""runtime.any.System.AppContext"",""4.1.0-rc2-23811"",""sha512-1"",""runtime"",""System.AppContext"",""lib\\dnxcore50\\System.AppContext.dll""
|
||||
""Package"",""runtime.any.System.AppContext"",""4.1.0-rc2-23812"",""sha512-1"",""runtime"",""System.AppContext"",""lib\\dnxcore50\\System.AppContext.dll""
|
||||
""Package"",""runtime.any.System.AppContext"",""4.1.0-rc2-23811"",""sha512-2"",""runtime"",""System.AppContext"",""lib\\dnxcore50\\System.AppContext.dll""
|
||||
""Package"",""runtime.any.System.AppContext2"",""4.1.0-rc2-23811"",""sha512-1"",""runtime"",""System.AppContext"",""lib\\dnxcore50\\System.AppContext.dll""
|
||||
""Project"",""runtime.any.System.AppContext"",""4.1.0-rc2-23811"",""sha512-1"",""runtime"",""System.AppContext"",""lib\\dnxcore50\\System.AppContext.dll""
|
||||
");
|
||||
context.RuntimeLibraries.Should().HaveCount(5);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData("text")]
|
||||
[InlineData(" ")]
|
||||
[InlineData("\"")]
|
||||
[InlineData(@""",""")]
|
||||
[InlineData(@"\\")]
|
||||
public void ThrowsFormatException(string intput)
|
||||
{
|
||||
Assert.Throws<FormatException>(() => Read(intput));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -26,7 +26,6 @@ namespace Microsoft.Extensions.DependencyModel.Tests
|
|||
@"{
|
||||
""runtimeTarget"": "".NETStandardApp,Version=v1.5/osx.10.10-x64"",
|
||||
""targets"": {
|
||||
"".NETStandardApp,Version=v1.5"": {},
|
||||
"".NETStandardApp,Version=v1.5/osx.10.10-x64"": {},
|
||||
}
|
||||
}");
|
||||
|
@ -35,21 +34,11 @@ namespace Microsoft.Extensions.DependencyModel.Tests
|
|||
context.Runtime.Should().Be("osx.10.10-x64");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void DefaultsToPortable()
|
||||
{
|
||||
var context = Read(
|
||||
@"{
|
||||
}");
|
||||
context.IsPortable.Should().BeTrue();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void SetsPortableIfRuntimeTargetHasNoRid()
|
||||
{
|
||||
var context = Read(
|
||||
@"{
|
||||
""runtimeTarget"": "".NETStandardApp,Version=v1.5"",
|
||||
""targets"": {
|
||||
"".NETStandardApp,Version=v1.5"": {}
|
||||
}
|
||||
|
@ -64,7 +53,6 @@ namespace Microsoft.Extensions.DependencyModel.Tests
|
|||
@"{
|
||||
""runtimeTarget"": "".NETStandardApp,Version=v1.5/osx.10.10-x64"",
|
||||
""targets"": {
|
||||
"".NETStandardApp,Version=v1.5"": {},
|
||||
"".NETStandardApp,Version=v1.5/osx.10.10-x64"": {}
|
||||
}
|
||||
}");
|
||||
|
@ -88,6 +76,9 @@ namespace Microsoft.Extensions.DependencyModel.Tests
|
|||
{
|
||||
var context = Read(
|
||||
@"{
|
||||
""targets"": {
|
||||
"".NETStandardApp,Version=v1.5/osx.10.10-x64"": {},
|
||||
},
|
||||
""runtimes"": {
|
||||
""osx.10.10-x64"": [ ],
|
||||
""osx.10.11-x64"": [ ""osx"" ],
|
||||
|
@ -237,6 +228,9 @@ namespace Microsoft.Extensions.DependencyModel.Tests
|
|||
""publicSign"": true,
|
||||
""warningsAsErrors"": true,
|
||||
""optimize"": true
|
||||
},
|
||||
""targets"": {
|
||||
"".NETStandardApp,Version=v1.5/osx.10.10-x64"": {},
|
||||
}
|
||||
}");
|
||||
context.CompilationOptions.AllowUnsafe.Should().Be(true);
|
||||
|
|
|
@ -40,7 +40,7 @@ namespace Microsoft.Extensions.DependencyModel.Tests
|
|||
IReadOnlyList<RuntimeFallbacks> runtimeGraph = null)
|
||||
{
|
||||
return new DependencyContext(
|
||||
target ?? string.Empty,
|
||||
target ?? "DefaultTarget",
|
||||
runtime ?? string.Empty,
|
||||
isPortable ?? false,
|
||||
compilationOptions ?? CompilationOptions.Default,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue