Beispiel #1
0
        public void Edit_NonExistingIdResultsInNotFound(int invalidValue)
        {
            var result = _controller.PutCustomer(invalidValue, new TEntity());

            Assert.AreEqual(HttpStatusCode.BadRequest, result.StatusCode,
                            "Ivalid id should produce BadRequest result");
        }
Beispiel #2
0
        public void Edit()
        {
            var rand      = new Random();
            var newEntity = CreateTestEntity(rand.Next(Int32.MaxValue));
            var id        = rand.Next(Entities.Count());

            newEntity.Id = id;

            var result = _controller.PutCustomer(id, newEntity);

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

            var updatedEntity = Entities.Single(d => d.Id == id);

            Assert.AreEqual(newEntity.ToEntity(), updatedEntity);
        }