public void PostAsync_overload5() { //Arrange RestInvoker target = new RestInvoker(_MyUri.OriginalString); StubModule.HaltProcessing = TimeSpan.FromSeconds(0); StubModule.PostPerson = false; StubModule.TestHarness = new List<Person> { new Person { Id = 1, Email = "*****@*****.**" } }; var body = new RestObjectRequestBody<Person>(new Person { Id = 2, Email = "*****@*****.**" }); //Act target.PostAsync("/Person", new { mode = "test" }, body, ContentType.ApplicationX_WWW_Form_UrlEncoded).ContinueWith(task => { using (RestResponse actual = task.Result) { //Assert Assert.Equal("?mode=test", actual.ResponseUri.Query); Assert.True(StubModule.PostPerson); Assert.NotNull(actual); Assert.True(actual.IsSuccessStatusCode); var person = StubModule.TestHarness.Where(x => x.Id == 2).FirstOrDefault(); Assert.NotNull(person); Assert.Equal("*****@*****.**", person.Email); } }).Wait(); }
public void PostAsync_overload2() { //Arrange RestInvoker target = new RestInvoker(_MyUri.OriginalString); StubModule.HaltProcessing = TimeSpan.FromSeconds(0); StubModule.PostPerson = false; StubModule.TestHarness = new List<Person> { new Person { Id = 1, Email = "*****@*****.**" } }; var uri = new RestUri(_MyUri, "/Person"); var body = new RestObjectRequestBody<Person>(new Person { Id = 2, Email = "*****@*****.**" }); //Act target.PostAsync(uri, body).ContinueWith(task => { using (RestResponse actual = task.Result) { //Assert Assert.True(StubModule.PostPerson); Assert.NotNull(actual); Assert.True(actual.IsSuccessStatusCode); var person = StubModule.TestHarness.Where(x => x.Id == 2).FirstOrDefault(); Assert.NotNull(person); Assert.Equal("*****@*****.**", person.Email); } }).Wait(); }