public async Task EnsuresNonNullArguments()
            {
                var client = new MergingClient(Substitute.For<IApiConnection>());

                var newMerge = new NewMerge("baseBranch", "shaToMerge") {CommitMessage = "some mergingMessage"};
                await AssertEx.Throws<ArgumentNullException>(async () => await client.Create(null, "name", newMerge));
                await AssertEx.Throws<ArgumentNullException>(async () => await client.Create("owner", null, newMerge));
                await AssertEx.Throws<ArgumentNullException>(async () => await client.Create("owner", "name", null));
                await AssertEx.Throws<ArgumentException>(async () => await client.Create("", "name", newMerge));
                await AssertEx.Throws<ArgumentException>(async () => await client.Create("owner", "", newMerge));            
                await AssertEx.Throws<ArgumentException>(async () => await client.Create("owner", "", null));            
            }
            public void RequestsTheCorrectUrlWithRepositoryId()
            {
                var connection = Substitute.For<IApiConnection>();
                var client = new MergingClient(connection);

                var newMerge = new NewMerge("baseBranch", "shaToMerge")
                {
                    CommitMessage = "some mergingMessage"
                };
                client.Create(1, newMerge);

                connection.Received().Post<Merge>(Arg.Is<Uri>(u => u.ToString() == "repositories/1/merges"),
                    Arg.Is<NewMerge>(nm => nm.Base == "baseBranch"
                                            && nm.Head == "shaToMerge"
                                            && nm.CommitMessage == "some mergingMessage"));
            }
Beispiel #3
0
            public void RequestsTheCorrectUrlWithRepositoryId()
            {
                var connection = Substitute.For <IApiConnection>();
                var client     = new MergingClient(connection);

                var newMerge = new NewMerge("baseBranch", "shaToMerge")
                {
                    CommitMessage = "some mergingMessage"
                };

                client.Create(1, newMerge);

                connection.Received().Post <Merge>(Arg.Is <Uri>(u => u.ToString() == "repositories/1/merges"),
                                                   Arg.Is <NewMerge>(nm => nm.Base == "baseBranch" &&
                                                                     nm.Head == "shaToMerge" &&
                                                                     nm.CommitMessage == "some mergingMessage"));
            }
Beispiel #4
0
            public async Task EnsuresNonNullArguments()
            {
                var client = new MergingClient(Substitute.For <IApiConnection>());

                var newMerge = new NewMerge("baseBranch", "shaToMerge")
                {
                    CommitMessage = "some mergingMessage"
                };
                await Assert.ThrowsAsync <ArgumentNullException>(() => client.Create(null, "name", newMerge));

                await Assert.ThrowsAsync <ArgumentNullException>(() => client.Create("owner", null, newMerge));

                await Assert.ThrowsAsync <ArgumentNullException>(() => client.Create("owner", "name", null));

                await Assert.ThrowsAsync <ArgumentException>(() => client.Create("", "name", newMerge));

                await Assert.ThrowsAsync <ArgumentException>(() => client.Create("owner", "", newMerge));

                await Assert.ThrowsAsync <ArgumentException>(() => client.Create("owner", "", null));
            }