Ejemplo n.º 1
0
        public void GivenNoWorkloadsAreInstalledSearchIsEmpty()
        {
            _reporter.Clear();
            var parseResult      = Parser.Instance.Parse("dotnet workload search");
            var workloadResolver = new MockWorkloadResolver(Enumerable.Empty <WorkloadResolver.WorkloadInfo>());
            var command          = new WorkloadSearchCommand(parseResult, _reporter, workloadResolver, "6.0.100");

            command.Execute();

            _reporter.Lines.Count.Should().Be(4, because: "Output should have header and no values.");
        }
Ejemplo n.º 2
0
        public void GivenWorkloadSearchItSearchesDescription()
        {
            _reporter.Clear();
            var parseResult      = Parser.Instance.Parse("dotnet workload search description");
            var workloadResolver = new MockWorkloadResolver(_availableWorkloads);
            var command          = new WorkloadSearchCommand(parseResult, _reporter, workloadResolver, "6.0.100");

            command.Execute();

            _reporter.Lines.Count.Should().Be(5);
            _reporter.Lines[3].Should().Contain("fake-workload-2");
        }
Ejemplo n.º 3
0
        public void GivenSearchResultsAreOrdered()
        {
            _reporter.Clear();
            var parseResult      = Parser.Instance.Parse("dotnet workload search");
            var workloadResolver = new MockWorkloadResolver(_availableWorkloads);
            var command          = new WorkloadSearchCommand(parseResult, _reporter, workloadResolver, "6.0.100");

            command.Execute();

            _reporter.Lines[3].Should().Contain("fake-workload-1");
            _reporter.Lines[4].Should().Contain("fake-workload-2");
            _reporter.Lines[5].Should().Contain("mock-workload-1");
            _reporter.Lines[6].Should().Contain("mock-workload-2");
            _reporter.Lines[7].Should().Contain("mock-workload-3");
        }
Ejemplo n.º 4
0
        public void GivenDetailedVerbositySearchShowsAllColumns()
        {
            _reporter.Clear();
            var parseResult      = Parser.Instance.Parse("dotnet workload search -v d");
            var workloadResolver = new MockWorkloadResolver(_availableWorkloads);
            var command          = new WorkloadSearchCommand(parseResult, _reporter, workloadResolver, "6.0.100");

            command.Execute();

            var output = string.Join(" ", _reporter.Lines);

            foreach (var workload in _availableWorkloads)
            {
                output.Contains(workload.Id.ToString()).Should().BeTrue();
                if (workload.Description != null)
                {
                    output.Contains(workload.Description).Should().BeTrue();
                }
            }
        }
Ejemplo n.º 5
0
        public void GivenStubIsProvidedSearchShowsAllMatchingWorkloads()
        {
            _reporter.Clear();
            var parseResult      = Parser.Instance.Parse("dotnet workload search mock");
            var workloadResolver = new MockWorkloadResolver(_availableWorkloads);
            var command          = new WorkloadSearchCommand(parseResult, _reporter, workloadResolver, "6.0.100");

            command.Execute();

            var output            = string.Join(" ", _reporter.Lines);
            var expectedWorkloads = _availableWorkloads.Take(3);

            foreach (var workload in expectedWorkloads)
            {
                output.Contains(workload.Id.ToString()).Should().BeTrue();
                if (workload.Description != null)
                {
                    output.Contains(workload.Description).Should().BeTrue();
                }
            }
        }
        public void GivenNoStubIsProvidedSearchShowsAllWorkloads()
        {
            _reporter.Clear();
            var parseResult      = Parser.GetWorkloadsInstance.Parse("dotnet workload search");
            var workloadResolver = new MockWorkloadResolver(_avaliableWorkloads);
            var command          = new WorkloadSearchCommand(parseResult, _reporter, workloadResolver, "6.0.100");

            command.Execute();

            var output = string.Join(" ", _reporter.Lines);

            foreach (var workload in _avaliableWorkloads)
            {
                output.Contains(workload.Id.ToString()).Should().BeTrue();
                if (workload.Description != null)
                {
                    output.Contains(workload.Description).Should().BeTrue();
                }
                if (workload.Platforms != null && workload.Platforms.Any())
                {
                    output.Contains(workload.Platforms.First().ToString()).Should().BeFalse();
                }
            }
        }