public async Task CreateAsync() { var apiConnection = Substitute.For <IApiConnection>(); var client = new ListingClient(apiConnection); await client.CreateAsync(new CreateListing()); await apiConnection.Received().ExecutePostAsync <object, Listing>("listings", Arg.Any <object>()); }
public async Task CreateAsync_CreateListingNull_Throw() { var apiConnection = Substitute.For <IApiConnection>(); var client = new ListingClient(apiConnection); await Assert.ThrowsExceptionAsync <ArgumentNullException>(async() => await client.CreateAsync(null)); await apiConnection.DidNotReceive().ExecutePostAsync <object, Listing>("listings", Arg.Any <object>()); }