Beispiel #1
0
        public static Package EmptyWorkspace([CallerMemberName] string testName = null, IPackageInitializer initializer = null, bool isRebuildablePackage = false)
        {
            if (!isRebuildablePackage)
            {
                return(new NonrebuildablePackage(directory: PackageUtilities.CreateDirectory(testName), initializer: initializer));
            }

            return(new RebuildablePackage(directory: PackageUtilities.CreateDirectory(testName), initializer: initializer));
        }
Beispiel #2
0
        public async Task PackageRegistry_will_return_same_instance_of_a_package()
        {
            // FIX: (PackageRegistry_will_return_same_instance_of_a_package)
            var packageName = PackageUtilities.CreateDirectory(nameof(PackageRegistry_will_return_same_instance_of_a_package)).Name;

            _registry.Add(packageName,
                          options => options.CreateUsingDotnet("console"));

            var package1 = await _registry.Get <IPackage>(packageName);

            var package2 = await _registry.Get <IPackage>(packageName);

            package1.Should().BeSameAs(package2);
        }
Beispiel #3
0
        public async Task Workspaces_can_be_registered_to_be_created_using_dotnet_new()
        {
            var packageName = PackageUtilities.CreateDirectory(nameof(Workspaces_can_be_registered_to_be_created_using_dotnet_new)).Name;

            _registry.Add(packageName,
                          options => options.CreateUsingDotnet("console"));

            var package = await _registry.Get <ICreateWorkspaceForRun>(packageName);

            var workspace = await package.CreateRoslynWorkspaceForRunAsync(new TimeBudget(30.Seconds()));

            var project = workspace.CurrentSolution.Projects.First();

            project.MetadataReferences.Count.Should().BeGreaterThan(0);
        }
Beispiel #4
0
        public async Task Workspace_can_be_registered_in_directory_other_than_the_default()
        {
            var parentDirectory = PackageUtilities.CreateDirectory(nameof(Workspace_can_be_registered_in_directory_other_than_the_default));

            var workspaceName = "a";

            var childDirectory = parentDirectory.CreateSubdirectory(workspaceName);

            _registry.Add(
                workspaceName,
                builder =>
            {
                builder.Directory = childDirectory;
            });

            var workspace = await _registry.Get <IHaveADirectory>(workspaceName);

            workspace.Directory.Should().Be(childDirectory);
        }
Beispiel #5
0
        public override IDirectoryAccessor CreateDirectory([CallerMemberName] string testName = null)
        {
            var directory = PackageUtilities.CreateDirectory(testName);

            return(new FileSystemDirectoryAccessor(directory));
        }