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)); }
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>()); }
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)); }