public void Post_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 using (RestResponse actual = target.Post("/Person", new { mode = "test" }, body, ContentType.ApplicationX_WWW_Form_UrlEncoded)) { //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); } }
public void Post_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 using (RestResponse actual = target.Post(uri, body)) { //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); } }