예제 #1
0
        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);
        }
예제 #2
0
        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);