public MockGenerator MockLibExplicitReferencesDll() { var mockPackageFile = new Mock<IPackageFile>(MockBehavior.Strict); mockPackageFile.Setup(x => x.Path).Returns(@"lib\dnx451\mylibfxsample.dll"); var mockPackageFileCore = new Mock<IPackageFile>(MockBehavior.Strict); mockPackageFileCore.Setup(x => x.Path).Returns(@"lib\dnx451\mylibfxsample2.dll"); PackageFiles.Add(mockPackageFile); PackageFiles.Add(mockPackageFileCore); FileSystem.Setup(x => x.FileExists(Path.Combine(Path.GetDirectoryName(NupkgFile), @"lib\dnx451\mylibfxsample.dll"))).Returns(true); var packageFiles = new List<IPackageFile> { mockPackageFile.Object, mockPackageFileCore.Object }; var assemblyMetadataDnx451 = new AssemblyMetadata { FullPath = Path.Combine(Path.GetDirectoryName(NupkgFile), @"lib\dnx451\mylibfxsample.dll"), TargetFrameworks = new List<string> { "dnx451" } }; PackageAssemblyMetadata.Add(assemblyMetadataDnx451); NugetPackage.Setup(x => x.PackageAssemblyReferences).Returns(new List<PackageReferenceSet> { new PackageReferenceSet(DnxVersionUtility.ParseFrameworkName("dnx451"), new [] { @"mylibfxsample.dll" }) }); var packageDir = Path.GetDirectoryName(NupkgFile); FileSystem.Setup(x => x.DirectoryGetFiles(packageDir, "*.dll", SearchOption.AllDirectories)) .Returns(PackageFiles.Select(x => Path.Combine(packageDir, x.Object.Path)).ToArray()); return this; }
public MockGenerator MockRefAnyDll() { var mockPackageFile = new Mock<IPackageFile>(MockBehavior.Strict); mockPackageFile.Setup(x => x.Path).Returns(@"ref\ANy\myAnySample.dLl"); var mockPackageFileLib = new Mock<IPackageFile>(MockBehavior.Strict); mockPackageFileLib.Setup(x => x.Path).Returns(@"lib\net45\myLibNoop.dLl"); PackageFiles.Add(mockPackageFile); PackageFiles.Add(mockPackageFileLib); FileSystem.Setup(x => x.FileExists(Path.Combine(Path.GetDirectoryName(NupkgFile), @"ref\ANy\myAnySample.dLl"))).Returns(true); var packageDir = Path.GetDirectoryName(NupkgFile); FileSystem.Setup(x => x.DirectoryGetFiles(packageDir, "*.dll", SearchOption.AllDirectories)) .Returns(PackageFiles.Select(x => Path.Combine(packageDir, x.Object.Path)).ToArray()); var packageFiles = new List<IPackageFile> { mockPackageFile.Object, mockPackageFileLib.Object }; var assemblyMetadata = new AssemblyMetadata { FullPath = Path.Combine(Path.GetDirectoryName(NupkgFile), @"ref\ANy\myAnySample.dLl"), TargetFrameworks = new List<string> { "net45", "dnx451" } }; PackageAssemblyMetadata.Add(assemblyMetadata); return this; }
public MockGenerator MockLibContractDll() { var mockPackageFile = new Mock<IPackageFile>(MockBehavior.Strict); mockPackageFile.Setup(x => x.Path).Returns(@"Lib\dnx451\myLibFxSample.dLl"); var mockPackageFileCore = new Mock<IPackageFile>(MockBehavior.Strict); mockPackageFileCore.Setup(x => x.Path).Returns(@"Lib\dnxcore451\myLibFxSample.dLl"); var mockPackageFileContract = new Mock<IPackageFile>(MockBehavior.Strict); mockPackageFileContract.Setup(x => x.Path).Returns(@"Lib\Contract\sampleBar.dLl"); PackageFiles.Add(mockPackageFile); PackageFiles.Add(mockPackageFileContract); PackageFiles.Add(mockPackageFileCore); FileSystem.Setup(x => x.FileExists(Path.Combine(Path.GetDirectoryName(NupkgFile), @"Lib\dnx451\myLibFxSample.dLl"))).Returns(true); FileSystem.Setup(x => x.FileExists(Path.Combine(Path.GetDirectoryName(NupkgFile), @"lib\contract\sampleBar.dll"))).Returns(true); var packageFiles = new List<IPackageFile> { mockPackageFile.Object, mockPackageFileContract.Object, mockPackageFileCore.Object }; var assemblyMetadataDnx451 = new AssemblyMetadata { FullPath = Path.Combine(Path.GetDirectoryName(NupkgFile), @"Lib\dnx451\myLibFxSample.dLl"), TargetFrameworks = new List<string> { "dnx451" } }; var assemblyMetadataDnxCore451 = new AssemblyMetadata { FullPath = Path.Combine(Path.GetDirectoryName(NupkgFile), @"lib\contract\sampleBar.dll"), TargetFrameworks = new List<string> { "dnxcore451" } }; PackageAssemblyMetadata.Add(assemblyMetadataDnx451); PackageAssemblyMetadata.Add(assemblyMetadataDnxCore451); var packageDir = Path.GetDirectoryName(NupkgFile); FileSystem.Setup(x => x.DirectoryGetFiles(packageDir, "*.dll", SearchOption.AllDirectories)) .Returns(PackageFiles.Select(x => Path.Combine(packageDir, x.Object.Path)).ToArray()); return this; }
public MockGenerator MockLibDllUnderRelativeFolderAsNupkg() { var mockPackageFile = new Mock<IPackageFile>(MockBehavior.Strict); mockPackageFile.Setup(x => x.Path).Returns(@"lib\net45\myRelSample.dLl"); PackageFiles.Add(mockPackageFile); FileSystem.Setup(x => x.FileExists(Path.Combine(Path.GetDirectoryName(NupkgFile), @"lib\net45\myRelSample.dLl"))).Returns(false); FileSystem.Setup(x => x.FileExists(Path.Combine(Path.GetDirectoryName(NupkgFile), Path.GetFileNameWithoutExtension(NupkgFile), @"lib\net45\myRelSample.dLl"))).Returns(true); var packageDir = Path.GetDirectoryName(NupkgFile); FileSystem.Setup(x => x.DirectoryGetFiles(packageDir, "*.dll", SearchOption.AllDirectories)) .Returns(PackageFiles.Select(x => Path.Combine(packageDir, x.Object.Path)).ToArray()); var packageFiles = new List<IPackageFile> { mockPackageFile.Object }; var assemblyMetadata = new AssemblyMetadata { FullPath = Path.Combine(Path.GetDirectoryName(NupkgFile), Path.GetFileNameWithoutExtension(NupkgFile), @"lib\net45\myRelSample.dLl"), TargetFrameworks = new List<string> { "net45", "dnx451" } }; PackageAssemblyMetadata.Add(assemblyMetadata); return this; }