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>()); }
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")); }
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")); }
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>()); }
public async Task EnsuresNonNullArguments() { var client = new UserKeysClient(Substitute.For<IApiConnection>()); await Assert.ThrowsAsync<ArgumentNullException>(() => client.Create(null)); }
public async Task EnsuresNonNullArguments() { var client = new UserKeysClient(Substitute.For <IApiConnection>()); await Assert.ThrowsAsync <ArgumentNullException>(() => client.Create(null)); }