Пример #1
0
            public async Task EnsuresNonNullArguments()
            {
                var client = new UserKeysClient(Substitute.For <IApiConnection>());
                await Assert.ThrowsAsync <ArgumentNullException>(() => client.GetAll(null));

                await Assert.ThrowsAsync <ArgumentNullException>(() => client.GetAll("fake", null));
            }
Пример #2
0
            public async Task EnsuresNonEmptyString()
            {
                var client    = new UserKeysClient(Substitute.For <IApiConnection>());
                var exception = await Assert.ThrowsAsync <ArgumentException>(() => client.GetAll(""));

                Assert.Equal("userName", exception.ParamName);
            }
            public void RequestsTheCorrectUrl()
            {
                var connection = Substitute.For<IApiConnection>();
                var client = new UserKeysClient(connection);

                var expectedUri = "users/auser/keys";
                client.GetAll("auser");

                connection.Received().GetAll<PublicKey>(
                    Arg.Is<Uri>(u => u.ToString() == expectedUri),
                    Arg.Any<ApiOptions>());
            }
Пример #4
0
            public void RequestsTheCorrectUrl()
            {
                var connection = Substitute.For <IApiConnection>();
                var client     = new UserKeysClient(connection);

                var expectedUri = "users/auser/keys";

                client.GetAll("auser");

                connection.Received().GetAll <PublicKey>(
                    Arg.Is <Uri>(u => u.ToString() == expectedUri));
            }
 public async Task EnsuresNonEmptyString()
 {
     var client = new UserKeysClient(Substitute.For<IApiConnection>());
     var exception = await Assert.ThrowsAsync<ArgumentException>(() => client.GetAll(""));
     Assert.Equal("userName", exception.ParamName);
 }
 public async Task EnsuresNonNullArguments()
 {
     var client = new UserKeysClient(Substitute.For<IApiConnection>());
     await Assert.ThrowsAsync<ArgumentNullException>(() => client.GetAll(null));
     await Assert.ThrowsAsync<ArgumentNullException>(() => client.GetAll("fake", null));
 }