public async Task EnsuresNonNullAndNonEmptyArguments()
            {
                var connection = Substitute.For<IApiConnection>();
                var client = new MigrationsClient(connection);

                await Assert.ThrowsAsync<ArgumentNullException>(() => client.GetAll(null));
                await Assert.ThrowsAsync<ArgumentException>(() => client.GetAll(""));
            }
Ejemplo n.º 2
0
            public async Task EnsuresNonNullAndNonEmptyArguments()
            {
                var connection = Substitute.For <IApiConnection>();
                var client     = new MigrationsClient(connection);

                await Assert.ThrowsAsync <ArgumentNullException>(() => client.GetAll(null));

                await Assert.ThrowsAsync <ArgumentException>(() => client.GetAll(""));
            }
Ejemplo n.º 3
0
            public void RequestsCorrectUrl()
            {
                var connection = Substitute.For <IApiConnection>();
                var client     = new MigrationsClient(connection);

                client.GetAll("fake");

                connection.Received().Get <List <Migration> >(
                    Arg.Is <Uri>(u => u.ToString() == "orgs/fake/migrations"),
                    null,
                    AcceptHeaders.MigrationsApiPreview);
            }
            public void RequestsCorrectUrl()
            {
                var connection = Substitute.For<IApiConnection>();
                var client = new MigrationsClient(connection);

                client.GetAll("fake");

                connection.Received().Get<List<Migration>>(
                    Arg.Is<Uri>(u => u.ToString() == "orgs/fake/migrations"),
                    null,
                    AcceptHeaders.MigrationsApiPreview);
            }
Ejemplo n.º 5
0
            public void RequestsCorrectUrl()
            {
                var connection = Substitute.For <IApiConnection>();
                var client     = new MigrationsClient(connection);

                client.GetAll("fake");

                connection.Received().GetAll <Migration>(
                    Arg.Is <Uri>(u => u.ToString() == "orgs/fake/migrations"),
                    null,
                    "application/vnd.github.wyandotte-preview+json",
                    Args.ApiOptions);
            }
            public void RequestsCorrectUrlApiOptions()
            {
                var connection = Substitute.For <IApiConnection>();
                var client     = new MigrationsClient(connection);

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

                client.GetAll("fake", options);

                connection.Received().GetAll <Migration>(
                    Arg.Is <Uri>(u => u.ToString() == "orgs/fake/migrations"),
                    null,
                    AcceptHeaders.MigrationsApiPreview,
                    options);
            }