public ENTITY PreProcessDTOPostPut(int homeId, DTO dto, Client currentClient, string path, object param) { path = string.Join(".", path, dto.GetType().Name); if (!GenericNames.ALLOWED_DTO_PATH.Contains(path)) { return(null); } ((IDTO)dto).HomeId = homeId; if (((IDTO)dto).Id == null) { return(null); } else if (((IDTO)dto).Id == 0) { return(PrePostDTOToEntity(currentClient, dto, path, param)); } else { ProcessDTOPostPut(dto, 0, currentClient); if (orig == null) { validationDictionnary.AddModelError(TypeOfName.GetNameFromType <ENTITY>(), GenericError.FORBIDDEN_RESOURCE_OR_DOES_NO_EXIST); } return(orig); } }
protected void ValidateNull <U>(U entity) where U : class { if (entity == null) { validationDictionnary.AddModelError(TypeOfName.GetNameFromType <U>(), GenericError.CANNOT_BE_NULL_OR_EMPTY); throw new ManahostValidationException(validationDictionnary); } }
protected void ValidateOrig() { if (orig == null) { validationDictionnary.AddModelError(TypeOfName.GetNameFromType <DTO>(), GenericError.FORBIDDEN_RESOURCE_OR_DOES_NO_EXIST); throw new ManahostValidationException(validationDictionnary); } }
protected override bool ValidatePut(System.Web.Http.ModelBinding.ModelStateDictionary validationDictionary, Client currentClient, Document entity, object param, params object[] additionalObjects) { NullCheckValidation.NullValidation(TypeOfName.GetNameFromType <Document>(), new Dictionary <String, Object>() { { "Hide", entity.Hide } }, validationDictionary); return(CommonValidation(validationDictionary, currentClient, entity, param, additionalObjects)); }
protected override bool ValidateDelete(ModelStateDictionary validationDictionary, Client currentClient, HomeConfig entity, object param, params object[] additionalObjects) { if (entity.Home.ClientId != currentClient.Id) { validationDictionary.AddModelError(TypeOfName.GetNameFromType <HomeConfig>(), GenericError.FORBIDDEN_RESOURCE_OR_DOES_NO_EXIST); } return(validationDictionary.IsValid); }
override protected bool ValidatePost(ModelStateDictionary validationDictionary, Client currentClient, PricePerPerson entity, object param, params object[] additionalObjects) { if (PricePerPersonRepository.GetPricePerPersonByRoomIdAndPeriod(entity.Room.Id, entity.Period.Id) != null) { validationDictionary.AddModelError(TypeOfName.GetNameFromType <PricePerPerson>(), GenericError.ALREADY_EXISTS); } return(CommonValidation(validationDictionary, currentClient, entity, param, additionalObjects)); }
protected override bool ValidatePost(System.Web.Http.ModelBinding.ModelStateDictionary validationDictionary, Client currentClient, MailModel entity, object param, params object[] additionalObjects) { IMailConfigRepository repo = (IMailConfigRepository)additionalObjects[0]; List <string> recipients = (List <string>)additionalObjects[1]; List <Document> attachments = (List <Document>)additionalObjects[2]; MailController.AdditionalRepositories addRepo = (MailController.AdditionalRepositories)param; NullCheckValidation.NullValidation(TypeOfName.GetNameFromType <MailModel>(), new Dictionary <String, Object>() { { "Body", entity.Body }, { "Subject", entity.Subject }, { "Password", entity.Password } }, validationDictionary); if (repo.GetMailConfigById(entity.MailConfigId, currentClient.Id) == null) { validationDictionary.AddModelError(String.Format(GenericNames.MODEL_STATE_FORMAT, TypeOfName.GetNameFromType <MailModel>(), "MailConfigId"), GenericError.FORBIDDEN_RESOURCE_OR_DOES_NO_EXIST); } if (entity.To.Count == 0) { validationDictionary.AddModelError(String.Format(GenericNames.MODEL_STATE_FORMAT, TypeOfName.GetNameFromType <MailModel>(), "To"), GenericError.CANNOT_BE_NULL_OR_EMPTY); } try { Encoding.UTF8.GetString(Convert.FromBase64String(entity.Password)); } catch (Exception) { validationDictionary.AddModelError(String.Format(GenericNames.MODEL_STATE_FORMAT, TypeOfName.GetNameFromType <MailModel>(), "Password"), GenericError.DOES_NOT_MEET_REQUIREMENTS); } foreach (int cur in entity.To) { People p = addRepo.PeopleRepo.GetPeopleById(cur, currentClient.Id); if (p == null) { validationDictionary.AddModelError(String.Format(GenericNames.MODEL_STATE_FORMAT, TypeOfName.GetNameFromType <MailModel>(), "To"), GenericError.FORBIDDEN_RESOURCE_OR_DOES_NO_EXIST); return(false); } if (p.AcceptMailing == true && p.Email != null) { recipients.Add(p.Email); } } if (entity.Attachments != null) { foreach (int cur in entity.Attachments) { Document d = addRepo.DocumentRepo.GetDocumentById(cur, currentClient.Id); if (d == null) { validationDictionary.AddModelError(String.Format(GenericNames.MODEL_STATE_FORMAT, TypeOfName.GetNameFromType <MailModel>(), "Attachments"), GenericError.FORBIDDEN_RESOURCE_OR_DOES_NO_EXIST); return(false); } attachments.Add(d); } } return(validationDictionary.IsValid); }
protected override bool ValidatePut(System.Web.Http.ModelBinding.ModelStateDictionary validationDictionary, Client currentClient, ProductBooking entity, object param, params object[] additionalObjects) { NullCheckValidation.NullValidation(TypeOfName.GetNameFromType <ProductBooking>(), new Dictionary <string, object>() { { "PriceHT", entity.PriceHT }, { "PriceTTC", entity.PriceTTC }, }, validationDictionary); return(CommonValidation(validationDictionary, currentClient, entity, param, additionalObjects)); }
/* ** ** Upload ** */ public virtual HttpResponseMessage UploadFile(Client currentClient, Document entity, HttpRequestMessage Request, IHomeRepository homeRepo, IDocumentLogRepository logRepo) { MyMultipartFileStreamProvider provider; Boolean isImage = false; ValidateNull(entity); if (entity != null && ((IDocumentRepository)repo).GetDocumentById(entity.Id, currentClient.Id) == null) { validationDictionnary.AddModelError(TypeOfName.GetNameFromType <Document>(), GenericError.FORBIDDEN_RESOURCE_OR_DOES_NO_EXIST); } if (!((DocumentValidation)validation).UploadValidationBeforeProvider(validationDictionnary, currentClient, entity, Request)) { throw new ManahostValidationException(validationDictionnary); } provider = new MyMultipartFileStreamProvider(ManahostUploadFileSystem.GetUploadFolderPath(WebApiApplication.UPLOAD_FOLDER_ROOT, currentClient.Id, (Boolean)entity.IsPrivate)); try { IEnumerable <HttpContent> parts = null; Task.Factory.StartNew(() => parts = Request.Content.ReadAsMultipartAsync(provider).Result.Contents, CancellationToken.None, TaskCreationOptions.LongRunning, // guarantees separate thread TaskScheduler.Default).Wait(); MultipartFileData file = provider.FileData.First(); if (!((DocumentValidation)validation).UploadValidationAfterProvider(validationDictionnary, currentClient, file)) { throw new ManahostValidationException(validationDictionnary); } if (isImage = ManahostUploadFileSystem.imageExtension.Any(s => entity.Title.EndsWith(s, StringComparison.OrdinalIgnoreCase))) { ImageCompressAndThumbnail(file.LocalFileName); } if ((Boolean)entity.IsPrivate && currentClient != null) { EncryptFileOnUpload(file.LocalFileName, DocumentUtils.GetEncryptionPassword(homeRepo, currentClient), isImage); } if (!UpdateEntitiesOnUpload(currentClient, entity, file.LocalFileName, isImage, logRepo)) { throw new ManahostValidationException(validationDictionnary); } } catch (Exception e) { if (validationDictionnary.IsValid) { validationDictionnary.AddModelError(String.Format(GenericNames.MODEL_STATE_FORMAT, TypeOfName.GetNameFromType <Document>(), "Upload"), GenericError.INVALID_GIVEN_PARAMETER); } if (entity.Url != null) { DocumentUtils.DeleteAllFile(entity.Url, isImage); } repo.Delete(entity); repo.Save(); throw new ManahostValidationException(validationDictionnary, e.StackTrace); } return(BuildStringContent.BuildFromRequestOK(Request)); }
public void DeleteForbidden() { reqCreator.CreateRequest(st, path + "/-1", HttpMethod.Delete, null, HttpStatusCode.BadRequest, false, true); reqCreator.AssertHttpError(1, new List <KeyValuePair <string, List <string> > >() { new KeyValuePair <string, List <string> >(TypeOfName.GetNameFromType <TaxDTO>(), new List <string>() { GenericError.FORBIDDEN_RESOURCE_OR_DOES_NO_EXIST }) }); }
public void PutForbiddenResource() { reqCreator.CreateRequest(st, path + "/-1", HttpMethod.Put, entity, HttpStatusCode.BadRequest, false, false); reqCreator.AssertHttpError(1, new List <KeyValuePair <string, List <string> > >() { new KeyValuePair <string, List <string> >(TypeOfName.GetNameFromType <HomeDTO>(), new List <string>() { GenericError.FORBIDDEN_RESOURCE_OR_DOES_NO_EXIST }) }); }
public override HomeDTO DoGet(Client current, int homeId, object param) { Home home = repo.GetHomeById(homeId, current.Id); if (home == null) { validationDictionnary.AddModelError(TypeOfName.GetNameFromType <Home>(), GenericError.FORBIDDEN_RESOURCE_OR_DOES_NO_EXIST); throw new ManahostValidationException(validationDictionnary); } return(GetMapper.Map <Home, HomeDTO>(home)); }
public void PostNull() { reqCreator.CreateRequest(st, path, HttpMethod.Post, null, HttpStatusCode.BadRequest, false, false); reqCreator.AssertHttpError(1, new List <KeyValuePair <string, List <string> > >() { new KeyValuePair <string, List <string> >(TypeOfName.GetNameFromType <RoomCategoryDTO>(), new List <string>() { GenericError.CANNOT_BE_NULL_OR_EMPTY }) }); }
public HomeDTO DoGetDefaultHome(Client currentClient) { Home home = repo.GetUniq(x => x.ClientId == currentClient.Id && x.isDefault == true); if (home == null) { validationDictionnary.AddModelError(TypeOfName.GetNameFromType <Home>(), GenericError.FORBIDDEN_RESOURCE_OR_DOES_NO_EXIST); throw new ManahostValidationException(validationDictionnary); } return(GetMapper.Map <Home, HomeDTO>(home)); }
public void PutNull() { reqCreator.CreateRequest(st, path + "/" + entity.Id, HttpMethod.Put, null, HttpStatusCode.BadRequest, false, false); reqCreator.AssertHttpError(1, new List <KeyValuePair <string, List <string> > >() { new KeyValuePair <string, List <string> >(TypeOfName.GetNameFromType <BookingStepBookingDTO>(), new List <string>() { GenericError.CANNOT_BE_NULL_OR_EMPTY }) }); }
protected override bool ValidatePost(System.Web.Http.ModelBinding.ModelStateDictionary validationDictionary, Client currentClient, Period entity, object param, params object[] additionalObjects) { if (param != null && entity != null && entity.End != null && entity.Begin != null && entity.Days > 0) { List <Period> periodList = PeriodRepository.GetPeriodByDates(entity.Begin, entity.End, currentClient.Id).ToList(); if (PeriodUtils.IsDaysCross(periodList, entity)) { validationDictionary.AddModelError(TypeOfName.GetNameFromType <Period>(), GenericError.ALREADY_EXISTS); } } return(CommonValidation(validationDictionary, currentClient, entity, param, additionalObjects)); }
public void PutInvalidEntity() { entity.Id = -1; reqCreator.CreateRequest(st, path + "/" + entity.Id, HttpMethod.Put, entity, HttpStatusCode.BadRequest, false, false); reqCreator.AssertHttpError(1, new List <KeyValuePair <string, List <string> > >() { new KeyValuePair <string, List <string> >(TypeOfName.GetNameFromType <RoomCategoryDTO>(), new List <string>() { GenericError.FORBIDDEN_RESOURCE_OR_DOES_NO_EXIST }) }); }
public virtual MailLog MailSteps(Client currentClient, MailBookingModel model, object param) { ValidateNull <MailBookingModel>(model); MailLog log = new MailLog(); HomeConfig hc = null; Document body = null; List <Document> listAttachments = null; BookingStepBookingRepository.includes.Add("CurrentStep"); BookingStepBookingRepository.includes.Add("CurrentStep.Documents"); BookingStepBookingRepository.includes.Add("CurrentStep.MailTemplate"); BookingStepBookingRepository.includes.Add("Booking"); BookingStepBookingRepository.includes.Add("Booking.People"); BookingStepBooking b = BookingStepBookingRepository.GetBookingStepBookingById(model.BookingId, currentClient.Id); if (b == null) { validationDictionnary.AddModelError(TypeOfName.GetNameFromType <Booking>(), GenericError.FORBIDDEN_RESOURCE_OR_DOES_NO_EXIST); throw new ManahostValidationException(validationDictionnary); } HomeConfigRepository.includes.Add("DefaultMailConfig"); hc = HomeConfigRepository.GetHomeConfigById(b.HomeId, currentClient.Id); if (!((BookingStepBookingValidation)validation).MailStepValidation(validationDictionnary, currentClient, hc, b, model, param)) { throw new ManahostValidationException(validationDictionnary); } if (b.CurrentStep.MailTemplate == null) { validationDictionnary.AddModelError("CurrentStep.MailTemplate", GenericError.CANNOT_BE_NULL_OR_EMPTY); throw new ManahostValidationException(validationDictionnary); } body = DocumentRepository.GetDocumentById(b.CurrentStep.MailTemplate.Id, currentClient.Id); listAttachments = b.CurrentStep.Documents; if (hc.DefaultMailConfig != null) { SendMailUsingCustomMailAccount(hc.DefaultMailConfig, b, log, model.Password, GetMailBody(body, b.Home), MailUtils.GetAttachments(listAttachments, b.Home)); } else { SendMailUsingManahostMailAccount(b, log, GetMailBody(body, b.Home), MailUtils.GetAttachments(listAttachments, b.Home)); } repo.Add <MailLog>(log); repo.Update(b); repo.Save(); return(log); }
/* ** Download Validation */ public bool DownloadValidation(System.Web.Http.ModelBinding.ModelStateDictionary validationDictionary, Client currentClient, Document entity) { String absoluteUrl = entity != null?DocumentUtils.GetFullDocumentUrl(entity.Url) : null; if (entity == null || (((Boolean)entity.IsPrivate) && currentClient == null)) { validationDictionary.AddModelError(TypeOfName.GetNameFromType <Document>(), GenericError.FORBIDDEN_RESOURCE_OR_DOES_NO_EXIST); } else { if (!File.Exists(absoluteUrl)) { validationDictionary.AddModelError(String.Format(GenericNames.MODEL_STATE_FORMAT, TypeOfName.GetNameFromType <Document>(), "Url"), GenericError.FILE_NOT_FOUND); } } return(validationDictionary.IsValid); }
protected override void DoDelete(Client currentClient, int id, object param) { Home home = repo.GetHomeById(id, currentClient.Id); if (home == null) { validationDictionnary.AddModelError(TypeOfName.GetNameFromType <Home>(), GenericError.FORBIDDEN_RESOURCE_OR_DOES_NO_EXIST); throw new ManahostValidationException(validationDictionnary); } if (currentClient.DefaultHomeId == id) { currentClient.DefaultHomeId = null; repo.Update <Client>(currentClient); } repo.Delete(home); repo.Save(); }
/* ** Upload Validation */ public bool UploadValidationBeforeProvider(System.Web.Http.ModelBinding.ModelStateDictionary validationDictionary, Client currentClient, Document entity, HttpRequestMessage Request) { if (entity == null) { validationDictionary.AddModelError(TypeOfName.GetNameFromType <Document>(), GenericError.FORBIDDEN_RESOURCE_OR_DOES_NO_EXIST); } else { if (entity.Url != null) { validationDictionary.AddModelError(String.Format(GenericNames.MODEL_STATE_FORMAT, TypeOfName.GetNameFromType <Document>(), "Url"), GenericError.ALREADY_EXISTS); } if (!Request.Content.IsMimeMultipartContent()) { validationDictionary.AddModelError(TypeOfName.GetNameFromType <Document>(), GenericError.WRONG_DATA); } } return(validationDictionary.IsValid); }
protected override bool ValidatePut(System.Web.Http.ModelBinding.ModelStateDictionary validationDictionary, Client currentClient, RoomBooking entity, object param, params object[] additionalObjects) { NullCheckValidation.NullValidation(TypeOfName.GetNameFromType <RoomBooking>(), new Dictionary <String, Object>() { { "DateBegin", entity.DateBegin }, { "DateEnd", entity.DateEnd } }, validationDictionary); if (!CommonValidation(validationDictionary, currentClient, entity, param, additionalObjects)) { return(false); } if (tmp != null && rtmp != null && RoomBookingRepository.FindRoomBookingForDates(entity.Room.Id, entity.Id, entity.DateBegin == null ? (DateTime)tmp.DateArrival : (DateTime)entity.DateBegin, entity.DateEnd == null ? (DateTime)tmp.DateDeparture : (DateTime)entity.DateEnd, currentClient.Id) != null) { validationDictionary.AddModelError(String.Format(GenericNames.MODEL_STATE_FORMAT, TypeOfName.GetNameFromType <RoomBooking>(), "RoomId"), GenericError.ALREADY_EXISTS); } return(validationDictionary.IsValid); }
public async Task ChangeDefaultHomeId(Client currentClient, int HomeId) { Home HomeSelectedForChange = repo.GetHomeById(HomeId, currentClient.Id); if (HomeSelectedForChange == null) { validationDictionnary.AddModelError(TypeOfName.GetNameFromType <Home>(), GenericError.FORBIDDEN_RESOURCE_OR_DOES_NO_EXIST); throw new ManahostValidationException(validationDictionnary); } Home HomeOnIsDefault = repo.GetUniq(x => x.Id != HomeId && x.isDefault == true); if (HomeOnIsDefault != null) { HomeOnIsDefault.isDefault = false; repo.Update(HomeOnIsDefault); } HomeSelectedForChange.isDefault = true; repo.Update(HomeSelectedForChange); await repo.SaveAsync(); }
public static IRuleBuilderOptions <T, String> EnsureValidName <T>(this IRuleBuilder <T, String> rule, TypeOfName type) { switch (type) { case TypeOfName.First: return(rule.Length(1, 35).Must(x => x.ToList().TrueForAll(Char.IsLetter))); case TypeOfName.Last: return(rule.Length(1, 35).Must(x => x.ToList().TrueForAll(Char.IsLetter))); case TypeOfName.Nickname: return(rule.Length(1, 25).Must(x => x.ToList().TrueForAll(Char.IsLetterOrDigit))); default: throw new ArgumentOutOfRangeException("type"); } }
public virtual DinnerBookingDTO Compute(Client currentClient, int id, object param) { Decimal priceHT = 0; Decimal priceTTC = 0; IEnumerable <MealBooking> mealBookings = null; ProcessDTOPostPut(null, id, currentClient); ValidateOrig(); repo.includes.Add("PeopleCategory"); repo.includes.Add("Meal"); mealBookings = repo.GetAllMealByDinnerBooking(id, currentClient.Id); foreach (MealBooking cur in mealBookings) { repo.includes.Add("Tax"); MealPrice priceForMeal = repo.GetMealPriceByPeopleCategoryId(cur.PeopleCategory.Id, (int)cur.Meal.Id, currentClient.Id); if (priceForMeal == null) { validationDictionnary.AddModelError(String.Format(GenericNames.MODEL_STATE_FORMAT, TypeOfName.GetNameFromType <DinnerBooking>(), "MealPrice"), GenericError.CANNOT_BE_NULL_OR_EMPTY); throw new ManahostValidationException(validationDictionnary); } Decimal tmpPrice = (Decimal)priceForMeal.PriceHT * (int)cur.NumberOfPeople; priceHT += tmpPrice; if (priceForMeal.Tax != null) { priceTTC += ComputePrice.ComputePriceFromPercentOrAmount(tmpPrice, (EValueType)priceForMeal.Tax.ValueType, (EValueType)priceForMeal.Tax.ValueType == EValueType.AMOUNT ? (Decimal)priceForMeal.Tax.Price * (int)cur.NumberOfPeople : (Decimal)priceForMeal.Tax.Price); } else { priceTTC += tmpPrice; } } orig.PriceHT = priceHT; orig.PriceTTC = priceTTC; repo.Update(orig); repo.Save(); return(GetMapper.Map <DinnerBooking, DinnerBookingDTO>(orig)); }
protected override bool CommonValidation(System.Web.Http.ModelBinding.ModelStateDictionary validationDictionary, Client currentClient, BookingStep entity, object param, params object[] additionalObjects) { BookingStep temp = null; if (entity.BookingStepNext != null) { temp = BookingStepRepository.GetBookingStepById(entity.BookingStepNext.Id, currentClient.Id); } if (temp != null) { if (entity.BookingStepConfig != null && temp.BookingStepConfig.Id != entity.BookingStepConfig.Id) { validationDictionary.AddModelError(String.Format(GenericNames.MODEL_STATE_FORMAT, TypeOfName.GetNameFromType <BookingStep>(), "BookingStepNext"), GenericError.INVALID_GIVEN_PARAMETER); } if (entity.BookingArchived && !temp.BookingArchived) { validationDictionary.AddModelError(String.Format(GenericNames.MODEL_STATE_FORMAT, TypeOfName.GetNameFromType <BookingStep>(), "BookingStepNext.BookingArchived"), GenericError.INVALID_GIVEN_PARAMETER); } } if (entity.BookingStepPrevious != null) { temp = BookingStepRepository.GetBookingStepById(entity.BookingStepPrevious.Id, currentClient.Id); } if (temp != null) { if (entity.BookingStepConfig != null && temp.BookingStepConfig.Id != entity.BookingStepConfig.Id) { validationDictionary.AddModelError(String.Format(GenericNames.MODEL_STATE_FORMAT, TypeOfName.GetNameFromType <BookingStep>(), "BookingStepPrevious"), GenericError.INVALID_GIVEN_PARAMETER); } } return(validationDictionary.IsValid); }
public bool PostFieldValidation(ModelStateDictionary validationDictionary, Client currentClient, int FieldGroupId, int PeopleId) { if ((FieldGroupRepository.GetFieldGroupById(FieldGroupId, currentClient.Id) == null)) { validationDictionary.AddModelError(String.Format(GenericNames.MODEL_STATE_FORMAT, TypeOfName.GetNameFromType <PeopleField>(), "FieldGroupId"), GenericError.FORBIDDEN_RESOURCE_OR_DOES_NO_EXIST); } if ((PeopleRepository.GetPeopleById(PeopleId, currentClient.Id)) == null) { validationDictionary.AddModelError(String.Format(GenericNames.MODEL_STATE_FORMAT, TypeOfName.GetNameFromType <PeopleField>(), "PeopleId"), GenericError.FORBIDDEN_RESOURCE_OR_DOES_NO_EXIST); } return(validationDictionary.IsValid); }
public void MailNullMailTemplate() { RequestCreator <MailBookingModel> reqCreator = new RequestCreator <MailBookingModel>(); reqCreator.CreateRequest(st, path + "/Mail", HttpMethod.Post, new MailBookingModel() { BookingId = 1, Password = "******" }, HttpStatusCode.BadRequest, false, false); reqCreator.AssertHttpError(1, new List <KeyValuePair <string, List <string> > >() { new KeyValuePair <string, List <string> >(String.Format(GenericNames.MODEL_STATE_FORMAT, TypeOfName.GetNameFromType <Booking>(), "MailTemplate"), new List <string>() { GenericError.CANNOT_BE_NULL_OR_EMPTY }), }); }
public void PostInvalidColor() { entity.Color = -1; reqCreator.CreateRequest(st, path, HttpMethod.Post, entity, HttpStatusCode.BadRequest, false, false); reqCreator.AssertHttpError(1, new List <KeyValuePair <string, List <string> > >() { new KeyValuePair <string, List <string> >(String.Format(GenericNames.MODEL_STATE_FORMAT, TypeOfName.GetNameFromType <Room>(), "Color"), new List <string>() { GenericError.WRONG_DATA }) }); entity.Color = 0xFFFFFF + 1; reqCreator.CreateRequest(st, path, HttpMethod.Post, entity, HttpStatusCode.BadRequest, false, false); reqCreator.AssertHttpError(1, new List <KeyValuePair <string, List <string> > >() { new KeyValuePair <string, List <string> >("Color", new List <string>() { GenericError.WRONG_DATA }) }); }
public void PutExceededDescription() { entity.Description = new string('*', 4001); reqCreator.CreateRequest(st, path + "/" + entity.Id, HttpMethod.Put, entity, HttpStatusCode.BadRequest, false, false); reqCreator.AssertHttpError(1, new List <KeyValuePair <string, List <string> > >() { new KeyValuePair <string, List <string> >(String.Format(GenericNames.MODEL_STATE_FORMAT, TypeOfName.GetNameFromType <Room>(), "Description"), new List <string>() { GenericError.DOES_NOT_MEET_REQUIREMENTS }) }); }