Пример #1
0
        public void UpdateShouldReturnNotFound()
        {
            this.countriesController.Configuration = new HttpConfiguration();

            var model = TestObjectFactoryDataTransferModels.GetValidUpdateCountryRequestModel();

            this.countriesController.Validate(model);

            var notFoundId = 10;
            var result     = this.countriesController.Update(notFoundId, model);

            Assert.AreEqual(typeof(NotFoundResult), result.GetType());
        }
Пример #2
0
        public void UpdateShouldReturnOkResultWithId()
        {
            this.countriesController.Configuration = new HttpConfiguration();

            var model = TestObjectFactoryDataTransferModels.GetValidUpdateCountryRequestModel();

            this.countriesController.Validate(model);

            var result   = this.countriesController.Update(model.Id, model);
            var okResult = result as OkNegotiatedContentResult <int>;

            Assert.IsNotNull(okResult);
            Assert.AreEqual(model.Id, okResult.Content);
        }