public void PostTest() { SchoolModel school = new SchoolModel() { Location = "bg", Name = "lelq vachka" }; var httpServer = new InMemoryHttpServer("http://localhost:4728/"); var response = httpServer.CreatePostRequest("api/school", school); Assert.AreEqual(HttpStatusCode.Created, response.StatusCode); Assert.IsNotNull(response.Content); var contentString = response.Content.ReadAsStringAsync().Result; var model = JsonConvert.DeserializeObject <SchoolModel>(contentString); Assert.IsTrue(model.Id > 0); }
public void PostTest() { SchoolModel school = new SchoolModel() { Location = "bg", Name = "lelq vachka" }; var httpServer = new InMemoryHttpServer("http://localhost:4728/"); var response = httpServer.CreatePostRequest("api/school", school); Assert.AreEqual(HttpStatusCode.Created, response.StatusCode); Assert.IsNotNull(response.Content); var contentString = response.Content.ReadAsStringAsync().Result; var model = JsonConvert.DeserializeObject<SchoolModel>(contentString); Assert.IsTrue(model.Id > 0); }
public void PostTest() { var student = new StudentModel() { FirstName = "Mimi", LastName = "Chervenopeyka", Age = 19, Grade = "12a" }; var httpServer = new InMemoryHttpServer("http://localhost:4728/"); var response = httpServer.CreatePostRequest("api/students", student); Assert.AreEqual(HttpStatusCode.Created, response.StatusCode); Assert.IsNotNull(response.Content); var contentString = response.Content.ReadAsStringAsync().Result; var model = JsonConvert.DeserializeObject <StudentModel>(contentString); Assert.IsTrue(model.Id > 0); }
public void PostTest() { var student = new StudentModel() { FirstName = "Mimi", LastName = "Chervenopeyka", Age = 19, Grade = "12a" }; var httpServer = new InMemoryHttpServer("http://localhost:4728/"); var response = httpServer.CreatePostRequest("api/students", student); Assert.AreEqual(HttpStatusCode.Created, response.StatusCode); Assert.IsNotNull(response.Content); var contentString = response.Content.ReadAsStringAsync().Result; var model = JsonConvert.DeserializeObject<StudentModel>(contentString); Assert.IsTrue(model.Id > 0); }