コード例 #1
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);
        }
コード例 #2
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);
        }
コード例 #3
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);
        }
コード例 #4
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);
        }