public void Put_overload5() { //Arrange RestInvoker target = new RestInvoker(_MyUri.OriginalString); StubModule.HaltProcessing = TimeSpan.FromSeconds(0); StubModule.PutPerson = false; StubModule.TestHarness = new List<Person> { new Person { Id = 1, Email = "*****@*****.**" } }; var body = new RestObjectRequestBody<Person>(new Person { Id = 1, Email = "*****@*****.**" }); //Act using (RestResponse actual = target.Put("/Person/{id}", new { id = 1 }, body, ContentType.ApplicationX_WWW_Form_UrlEncoded)) { //Assert Assert.True(StubModule.PutPerson); Assert.NotNull(actual); Assert.True(actual.IsSuccessStatusCode); var person = StubModule.TestHarness.Where(x => x.Id == 1).FirstOrDefault(); Assert.NotNull(person); Assert.Equal("*****@*****.**", person.Email); } }
public void Put_overload2() { //Arrange RestInvoker target = new RestInvoker(_MyUri.OriginalString); StubModule.HaltProcessing = TimeSpan.FromSeconds(0); StubModule.PutPerson = false; StubModule.TestHarness = new List<Person> { new Person { Id = 1, Email = "*****@*****.**" } }; var uri = new RestUri(_MyUri, "/Person/{id}").SetParameter("id", "1"); var body = new RestObjectRequestBody<Person>(new Person { Id = 1, Email = "*****@*****.**" }); //Act using (RestResponse actual = target.Put(uri, body)) { //Assert Assert.True(StubModule.PutPerson); Assert.NotNull(actual); Assert.True(actual.IsSuccessStatusCode); var person = StubModule.TestHarness.Where(x => x.Id == 1).FirstOrDefault(); Assert.NotNull(person); Assert.Equal("*****@*****.**", person.Email); } }