public void It_can_have_assets_added_to_it() { var directoryAccessor = new InMemoryDirectoryAccessor(); var package = new Package2("the-package", directoryAccessor); var projectAsset = new ProjectAsset(directoryAccessor); package.Add(projectAsset); package.Assets.Should().Contain(a => a == projectAsset); }
public async Task <T> Find <T>(PackageDescriptor descriptor) where T : class, IPackage { if (!descriptor.IsPathSpecified) { if (_directoryAccessor.DirectoryExists(descriptor.Name)) { var directoryAccessor = _directoryAccessor.GetDirectoryAccessorForRelativePath(descriptor.Name); var pkg = new Package2( descriptor, directoryAccessor); pkg.Add(new ProjectAsset(directoryAccessor)); if (pkg is T t) { return(t); } } } return(default);