public void GetAd_ShouldReturnCorrectAd() { System.Guid guid = new Guid("47054813-e54e-e411-941d-a41f7255f9b5"); //Bajsanski var response = controller.GetAd(guid); Assert.AreEqual(HttpStatusCode.OK, response.StatusCode); var ad = response.Content.ReadAsAsync <Ad>().Result; Assert.AreEqual(guid, ad.Id); Assert.AreEqual("Bajsanski", ad.Name); }
public void PutComment_ShouldBeInserted() { int count = comments.Count; var commentModel = new CommentModel { Id = Guid.NewGuid(), Text = "CommentInsert", AdId = new Guid("ee4cd8a2-eb0e-453d-a3b5-081b9165942e"), UserId = new Guid("fa8849b6-c4b6-47d5-96a0-109b0500047a")//user1 }; var response = controllerC.PutComment(commentModel); Assert.AreEqual(HttpStatusCode.Created, response.StatusCode); Assert.AreEqual(count + 1, comments.Count); Assert.AreEqual(0, commentModel.Counter); var comment = response.Content.ReadAsAsync <Comment>().Result; Assert.AreEqual("user1", comment.Username); var adModel = controllerA.GetAd(comment.AdId); var ad = adModel.Content.ReadAsAsync <AdModel>().Result; Assert.AreEqual(ads.First().Value.CommentCounter, ad.CommentCounter); }