Exemplo n.º 1
0
        public void RequestsCorrectGetAllUrl()
        {
            var connection = Substitute.For<IApiConnection>();
            var client = new GistsClient(connection);

            client.GetAll();
            connection.Received().GetAll<Gist>(Arg.Is<Uri>(u => u.ToString() == "gists"), Args.ApiOptions);
        }
Exemplo n.º 2
0
        public void RequestsCorrectGetAllWithSinceUrl()
        {
            var connection = Substitute.For<IApiConnection>();
            var client = new GistsClient(connection);
            DateTimeOffset since = DateTimeOffset.Now;
            client.GetAll(since);

            connection.Received().GetAll<Gist>(Arg.Is<Uri>(u => u.ToString() == "gists"), 
                Arg.Is<IDictionary<string,string>>(x => x.ContainsKey("since")));
        }
Exemplo n.º 3
0
        public void RequestsCorrectGetAllUrlWithApiOptions()
        {
            var connection = Substitute.For<IApiConnection>();
            var client = new GistsClient(connection);

            var options = new ApiOptions
            {
                PageSize = 1,
                PageCount = 1,
                StartPage = 1
            };

            client.GetAll(options);

            connection.Received().GetAll<Gist>(Arg.Is<Uri>(u => u.ToString() == "gists"), options);

        }
Exemplo n.º 4
0
        public void RequestsCorrectGetAllWithSinceUrlAndApiOptions()
        {
            var connection = Substitute.For<IApiConnection>();
            var client = new GistsClient(connection);

            var options = new ApiOptions
            {
                PageSize = 1,
                PageCount = 1,
                StartPage = 1
            };
            DateTimeOffset since = DateTimeOffset.Now;
            client.GetAll(since, options);

            connection.Received().GetAll<Gist>(Arg.Is<Uri>(u => u.ToString() == "gists"),
                DictionaryWithSince, options);

        }
Exemplo n.º 5
0
        public void RequestsCorrectGetAllWithSinceUrl()
        {
            var connection = Substitute.For<IApiConnection>();
            var client = new GistsClient(connection);

            DateTimeOffset since = DateTimeOffset.Now;
            client.GetAll(since);

            connection.Received().GetAll<Gist>(Arg.Is<Uri>(u => u.ToString() == "gists"),
        DictionaryWithSince, Args.ApiOptions);
        }
Exemplo n.º 6
0
        public async Task EnsureNonNullArguments()
        {
            var connection = Substitute.For<IApiConnection>();
            var client = new GistsClient(connection);

            await Assert.ThrowsAsync<ArgumentNullException>(() => client.GetAll(null));
            await Assert.ThrowsAsync<ArgumentNullException>(() => client.GetAll(DateTimeOffset.Now, null));
        }