public void GetTest() { var schoolModels = new List <SchoolModel>(); var httpServer = new InMemoryHttpServer("http://localhost:4728/"); var response = httpServer.CreateGetRequest("api/school"); Assert.AreEqual(HttpStatusCode.OK, response.StatusCode); Assert.IsNotNull(response.Content); }
public void GetTest() { var studentModels = new List<StudentModel>(); var httpServer = new InMemoryHttpServer("http://localhost:4728/"); var response = httpServer.CreateGetRequest("api/students"); Assert.AreEqual(HttpStatusCode.OK, response.StatusCode); Assert.IsNotNull(response.Content); }
public void GetByIdTest() { PostTest(); var httpServer = new InMemoryHttpServer("http://localhost:4728/"); var response = httpServer.CreateGetRequest("api/school"); Assert.AreEqual(HttpStatusCode.OK, response.StatusCode); Assert.IsNotNull(response.Content); var contentString = response.Content.ReadAsStringAsync().Result; var model = JsonConvert.DeserializeObject <SchoolModel>(contentString); Assert.IsTrue(model.Id == 1); }
public void GetByIdTest() { PostTest(); var httpServer = new InMemoryHttpServer("http://localhost:4728/"); var response = httpServer.CreateGetRequest("api/school"); Assert.AreEqual(HttpStatusCode.OK, response.StatusCode); Assert.IsNotNull(response.Content); var contentString = response.Content.ReadAsStringAsync().Result; var model = JsonConvert.DeserializeObject<SchoolModel>(contentString); Assert.IsTrue(model.Id == 1); }
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); }