public void PackageMetadata_WhenNoExesFoundButSingleDll_CallsMapperToMapFromThatDll() { var fileSystem = new MockFileSystem(new Dictionary <string, MockFileData>() { { Path.Combine(_rootDir, "file.dll"), new MockFileData(new byte[0]) } }); var ipdfsfe = new InferPackageDetailsFromSingleFoundExecutable(fileSystem, _mapper.Object); var meta = new PackageMetadata(); ipdfsfe.DiscoverMetadataProperties(meta, _rootDir); _mapper.Verify(x => x.MapAssemblyInfoToPackage(_rootDir + "\\file.dll", It.IsAny <PackageMetadata>())); }
public void PackageMetadata_WhenMoreThanOneExeIsFound_MapperNotCalled() { var fileSystem = new MockFileSystem(new Dictionary <string, MockFileData>() { { Path.Combine(_rootDir, "one.exe"), new MockFileData(new byte[0]) }, { Path.Combine(_rootDir, "two.exe"), new MockFileData(new byte[0]) }, }); var ipdfsfe = new InferPackageDetailsFromSingleFoundExecutable(fileSystem, _mapper.Object); var meta = new PackageMetadata(); ipdfsfe.DiscoverMetadataProperties(meta, _rootDir); _mapper.Verify(x => x.MapAssemblyInfoToPackage(It.IsAny <string>(), It.IsAny <PackageMetadata>()), Times.Never()); }
public void PackageMetadata_WhenOneSingleExeIsFound_CallsMapperToMapFromThatExe() { var fileSystem = new MockFileSystem(new Dictionary <string, MockFileData>() { { Path.Combine(_rootDir, "one.exe"), new MockFileData(new byte[0]) } }); var ipdfsfe = new InferPackageDetailsFromSingleFoundExecutable(fileSystem, _mapper.Object); var meta = new PackageMetadata(); ipdfsfe.DiscoverMetadataProperties(meta, _rootDir); _mapper.Verify(); Assert.That(meta.Description, Is.EqualTo("Updated")); }
public void PackageMetadata_WhenMultipleExesFound_DllsArentCheckedAsTheyAreLessImportant() { var fileSystem = new MockFileSystem(new Dictionary <string, MockFileData>() { { Path.Combine(_rootDir, "one.exe"), new MockFileData(new byte[0]) }, { Path.Combine(_rootDir, "two.exe"), new MockFileData(new byte[0]) }, { Path.Combine(_rootDir, "file.dll"), new MockFileData(new byte[0]) }, }); var ipdfsfe = new InferPackageDetailsFromSingleFoundExecutable(fileSystem, _mapper.Object); var meta = new PackageMetadata(); ipdfsfe.DiscoverMetadataProperties(meta, _rootDir); _mapper.Verify(x => x.MapAssemblyInfoToPackage(_rootDir + "\\file.dll", It.IsAny <PackageMetadata>()), Times.Never()); }