コード例 #1
0
            public void RequestsTheCorrectUrl()
            {
                var connection = Substitute.For <IApiConnection>();
                var client     = new UserKeysClient(connection);

                var expectedUri = "user/keys";

                client.Create(new NewPublicKey("title", "ABCDEFG"));

                connection.Received().Post <PublicKey>(
                    Arg.Is <Uri>(u => u.ToString() == expectedUri),
                    Arg.Any <object>());
            }
コード例 #2
0
            public void PassesRequestObject()
            {
                var connection = Substitute.For <IApiConnection>();
                var client     = new UserKeysClient(connection);

                client.Create(new NewPublicKey("title", "ABCDEFG"));

                connection.Received().Post <PublicKey>(
                    Arg.Any <Uri>(),
                    Arg.Is <NewPublicKey>(a =>
                                          a.Title == "title" &&
                                          a.Key == "ABCDEFG"));
            }
コード例 #3
0
            public void PassesRequestObject()
            {
                var connection = Substitute.For<IApiConnection>();
                var client = new UserKeysClient(connection);

                client.Create(new NewPublicKey("title", "ABCDEFG"));

                connection.Received().Post<PublicKey>(
                    Arg.Any<Uri>(),
                    Arg.Is<NewPublicKey>(a =>
                        a.Title == "title" &&
                        a.Key == "ABCDEFG"));
            }
コード例 #4
0
            public void RequestsTheCorrectUrl()
            {
                var connection = Substitute.For<IApiConnection>();
                var client = new UserKeysClient(connection);

                var expectedUri = "user/keys";
                client.Create(new NewPublicKey("title", "ABCDEFG"));

                connection.Received().Post<PublicKey>(
                    Arg.Is<Uri>(u => u.ToString() == expectedUri),
                    Arg.Any<object>());
            }
コード例 #5
0
 public async Task EnsuresNonNullArguments()
 {
     var client = new UserKeysClient(Substitute.For<IApiConnection>());
     await Assert.ThrowsAsync<ArgumentNullException>(() => client.Create(null));
 }
コード例 #6
0
 public async Task EnsuresNonNullArguments()
 {
     var client = new UserKeysClient(Substitute.For <IApiConnection>());
     await Assert.ThrowsAsync <ArgumentNullException>(() => client.Create(null));
 }