<commit_before>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Moq;
using NuGet.Commands;
using NuGet.Common;
using Xunit;
using Xunit.Extensions;

namespace NuGet.Test.NuGetCommandLine.Commands
{
    public class SourcesCommandTest
    {
        [Fact]
        public void ProvidingNoArgumentListsPackages()
        {
            // Arrange
            var packageSourceProvider = new Mock<IPackageSourceProvider>();
            packageSourceProvider.Setup(c => c.LoadPackageSources()).Returns(new[] { new PackageSource("FirstSource", "FirstName") });
            var sourceCommand = new SourcesCommand()
            {
                SourceProvider = packageSourceProvider.Object,
            };

            var console = new MockConsole();

            sourceCommand.Console = console;

            // Act
            sourceCommand.ExecuteCommand();

            string expectedText =
@"Registered Sources:
  1.  FirstName [Enabled]
      FirstSource
";

            // Assert
            Assert.Equal(expectedText, console.Output);
        }

        [Fact]
        public void ProvidingListArgumentListsPackages()
        {
            // Arrange
            var packageSourceProvider = new Mock<IPackageSourceProvider>();
            packageSourceProvider.Setup(c => c.LoadPackageSources()).Returns(new[] { new PackageSource("FirstSource", "FirstName", isEnabled: false) });
            var sourceCommand = new SourcesCommand()
            {
                SourceProvider = packageSourceProvider.Object
            };
            sourceCommand.Arguments.Add("list");

            var console = new MockConsole();

            sourceCommand.Console = console;

            // Act
            sourceCommand.ExecuteCommand();

            string expectedText =
@"Registered Sources:
  1.  FirstName [Disabled]
      FirstSource
";
            // Assert
            Assert.Equal(expectedText, console.Output);
        }

        [Theory]
        [InlineData(new object[] { null })]
        [InlineData(new object[] { "" })]
        public void AddCommandThrowsIfNameIsNullOrEmpty(string name)
        {
            // Arrange<commit_msg>Fix stupid line ending issue of git<commit_after>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Moq;
using NuGet.Commands;
using NuGet.Common;
using Xunit;
using Xunit.Extensions;

namespace NuGet.Test.NuGetCommandLine.Commands
{
    public class SourcesCommandTest
    {
        [Fact]
        public void ProvidingNoArgumentListsPackages()
        {
            // Arrange
            var packageSourceProvider = new Mock<IPackageSourceProvider>();
            packageSourceProvider.Setup(c => c.LoadPackageSources()).Returns(new[] { new PackageSource("FirstSource", "FirstName") });
            var sourceCommand = new SourcesCommand()
            {
                SourceProvider = packageSourceProvider.Object,
            };

            var console = new MockConsole();

            string expectedText =
@"Registered Sources:
  1.  FirstName [Enabled]
      FirstSource
";

            sourceCommand.Console = console;

            // Act
            sourceCommand.ExecuteCommand();

            // Assert
            Assert.Equal(expectedText, console.Output);
        }

        [Fact]
        public void ProvidingListArgumentListsPackages()
        {
            // Arrange
            var packageSourceProvider = new Mock<IPackageSourceProvider>();
            packageSourceProvider.Setup(c => c.LoadPackageSources()).Returns(new[] { new PackageSource("FirstSource", "FirstName", isEnabled: false) });
            var sourceCommand = new SourcesCommand()
            {
                SourceProvider = packageSourceProvider.Object
            };
            sourceCommand.Arguments.Add("list");

            var console = new MockConsole();

            string expectedText =
@"Registered Sources:
  1.  FirstName [Disabled]
      FirstSource
";

            sourceCommand.Console = console;

            // Act
            sourceCommand.ExecuteCommand();

            // Assert
            Assert.Equal(expectedText, console.Output);
        }

        [Theory]
        [InlineData(new object[] { null })]
        [InlineData(new object[] { "" })]
        public void AddCommandThrowsIfNameIsNullOrEmpty(string name)
        {
            // Arrange
{'fraction_non_alphanumeric': 0.09556313993174062, 'fraction_numerical': 0.0009101251422070534, 'mean_word_length': 2.0741258741258743, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '923257', 'n_tokens_mistral': 1092, 'n_tokens_neox': 1052, 'n_words': 235}