Exemple #1
0
        public void Delete_NonExistingIdResultsInNotFound(int invalidValue)
        {
            var result = _controller.Delete(invalidValue);

            Assert.AreEqual(HttpStatusCode.NotFound, result.StatusCode,
                            "Ivalid id should produce NotFound result");
        }
Exemple #2
0
        public void Delete()
        {
            var id = new Random().Next(Entities.Count());

            var result = _controller.Delete(id);

            Assert.AreEqual(HttpStatusCode.OK, result.StatusCode,
                            "Delete action with valid id should result in OK");

            Assert.IsNull(Entities.SingleOrDefault(d => d.Id == id),
                          "Delete should remove the specified entity from list ({0})", id);
        }