public async Task CanDoBasicPut() { var client = new DummyRestClient(); var path = "/posts/1"; var originalPost = await client.Get().SendAsync( path, _Deserialize <Post> ); var modifiedPost = new Post { Id = originalPost.Id, UserId = 12345, Title = Guid.NewGuid().ToString(), Body = Guid.NewGuid().ToString(), }; var updatedPost = await client.Put(_AsJsonContent).SendAsync( path, modifiedPost, _Deserialize <Post> ); Assert.Equal(originalPost.Id, updatedPost.Id); Assert.NotEqual(originalPost.UserId, updatedPost.UserId); Assert.NotEqual(originalPost.Title, updatedPost.Title); Assert.NotEqual(originalPost.Body, updatedPost.Body); Assert.Equal(modifiedPost.Id, updatedPost.Id); Assert.Equal(modifiedPost.UserId, updatedPost.UserId); Assert.Equal(modifiedPost.Title, updatedPost.Title); Assert.Equal(modifiedPost.Body, updatedPost.Body); }
public async Task CanDoBasicGet() { var client = new DummyRestClient(); var posts = await client.Get().SendAsync( "/posts", _Deserialize <IEnumerable <Post> > ); Assert.NotEmpty(posts); }