예제 #1
0
        public void It_can_have_assets_added_to_it()
        {
            var directoryAccessor = new InMemoryDirectoryAccessor();

            var package = new Package2("the-package", directoryAccessor);

            directoryAccessor.Add(("mainProject.csproj", ""));
            var projectAsset = new ProjectAsset(directoryAccessor, "mainProject.csproj");

            package.Add(projectAsset);

            package.Assets.Should().Contain(a => a == projectAsset);
        }
예제 #2
0
        public void An_asset_must_be_in_a_subdirectory_of_the_package()
        {
            var directoryAccessor = new InMemoryDirectoryAccessor();

            directoryAccessor.Add(("./2/mainProject.csproj", ""));
            var package = new Package2("1", directoryAccessor.GetDirectoryAccessorForRelativePath("1"));

            var projectAsset = new ProjectAsset(directoryAccessor.GetDirectoryAccessorForRelativePath("2"), "mainProject.csproj");

            package.Invoking(p => p.Add(projectAsset)).Should()
            .Throw <ArgumentException>()
            .And
            .Message
            .Should()
            .StartWith("Asset must be located under package path");
        }