public void Post_ShouldReturnCreated() { _post = TestDbPopulator.GetPost(3, 1); PostDTO postDto = _mapper.Map <Post, PostDTO>(_post); var response = _controller.Post(postDto); var result = TestHelper.ParsePostResponse(response); Assert.AreEqual(HttpStatusCode.Created, response.StatusCode); Assert.IsNotNull(result.Data.Id); Assert.IsNotNull(result.Data.Sas); }
public void Post_ShouldReturnUnauth() { _post = TestDbPopulator.GetPost(3, 1); PostDTO postDto = _mapper.Map <Post, PostDTO>(_post); var req = new HttpRequestMessage { RequestUri = new Uri("http://localhost:50268/api/Post") }; req.Properties[HttpPropertyKeys.HttpConfigurationKey] = new HttpConfiguration(); _controller = new PostApiController(TestContext) { Request = req }; var response = _controller.Post(postDto); var result = TestHelper.ParsePostResponse(response); Assert.AreEqual(HttpStatusCode.OK, response.StatusCode); }