public void ReturnsNothingForNoFilesAndNoFrameworkReferences() { // Arrange var fakeStream = CreateTestPackageStream(); var fakeNupkg = new Nupkg(fakeStream, leaveOpen: false); // Act var fx = fakeNupkg.GetSupportedFrameworks(); // Assert Assert.Empty(fx); }
public void ReturnsFilePathFrameworksIfPresent(string directoryName, FrameworkName fxName) { // Arrange var fakeStream = CreateTestPackageStream(b => { b.Files.Add(CreateMockPackageFile(@"lib\" + directoryName + @"\file.dll")); }); var fakeNupkg = new Nupkg(fakeStream, leaveOpen: false); // Act var fx = fakeNupkg.GetSupportedFrameworks(); // Assert Assert.Equal(new[] { fxName, }, fx.ToArray()); }
public void ReturnsFrameworkAssemblyReferenceFrameworksIfNoFileFrameworks() { // Arrange var fakeStream = CreateTestPackageStream(b => { b.FrameworkReferences.Add(new FrameworkAssemblyReference("foo", new[] { VersionUtility.ParseFrameworkName("net45"), VersionUtility.ParseFrameworkName("sl-wp70") })); }); var fakeNupkg = new Nupkg(fakeStream, leaveOpen: false); // Act var fx = fakeNupkg.GetSupportedFrameworks(); // Assert Assert.Equal(new[] { new FrameworkName(".NETFramework, Version=4.5"), new FrameworkName("Silverlight, Version=v0.0, Profile=wp70") }, fx.ToArray()); }
public void ReturnsUnionOfFrameworkReferenceAndFileFrameworks() { // Arrange var fakeStream = CreateTestPackageStream(b => { b.Files.Add(CreateMockPackageFile(@"lib\net40\file.dll")); b.Files.Add(CreateMockPackageFile(@"lib\win\file.dll")); b.FrameworkReferences.Add(new FrameworkAssemblyReference("Windows", new[] { new FrameworkName("Windows, Version=0.0") })); b.FrameworkReferences.Add(new FrameworkAssemblyReference("System.Net.Http", new[] { new FrameworkName(".NETFramework, Version=2.0") })); }); var fakeNupkg = new Nupkg(fakeStream, leaveOpen: false); // Act var fx = fakeNupkg.GetSupportedFrameworks(); // Assert Assert.Equal(new[] { new FrameworkName("Windows, Version=0.0"), new FrameworkName(".NETFramework, Version=2.0"), new FrameworkName(".NETFramework, Version=4.0"), }, fx.ToArray()); }