using System;
using NSubstitute;
using Xunit;

namespace Octokit.Tests.Clients
{
    /// <summary>
    /// Client tests mostly just need to make sure they call the IApiConnection with the correct 
    /// relative Uri. No need to fake up the response. All *those* tests are in ApiConnectionTests.cs.
    /// </summary>
    public class FeedsClientTests
    {
        public class TheCtor
        {
            [Fact]
            public void EnsuresNonNullArguments()
            {
                Assert.Throws<ArgumentNullException>(() => new FeedsClient(null));
            }
        }

        public class TheGetFeedsMethod
        {
            [Fact]
            public void RequestsCorrectUrl()
            {
                var connection = Substitute.For<IApiConnection>();
                var feedsClient = new FeedsClient(connection);

                feedsClient.GetFeeds();

                connection.Received().Get<Feed>(Arg.Is<Uri>(u => u.ToString() == "feeds"));
            }
        }
    }
}