public void TestForRatingRange() { // Arrange BeersController controller = new BeersController(new TestPathProvider()); string beerId = "2"; UserRating ratingObj = new UserRating(); ratingObj.rating = 9; ratingObj.username = "******"; ratingObj.comments = "Very Nice"; string actualResponse = "Rating should be in the range 1 to 5"; // Act var response = controller.AddRating(beerId, ratingObj); // Assert Assert.IsNotNull(response); Assert.AreEqual(actualResponse, response); }
public void TestForAddRatingEndPoint() { // Arrange BeersController controller = new BeersController(new TestPathProvider()); string beerId = "2"; UserRating ratingObj = new UserRating(); ratingObj.rating = 4; ratingObj.username = "******"; ratingObj.comments = "Nice"; string actualResponse = "Thank you for your rating. Your response is added successfully!"; // Act var response = controller.AddRating(beerId, ratingObj); // Assert Assert.IsNotNull(response); Assert.AreEqual(actualResponse, response); }