public async Task GetAllDescriptionsByServiceAsync() { var service = new DescriptionService(); var listDescriptions = await service.GetAllDescriptionsByInterestPoint(SelectedInterestPoint.InterestPoint.IdInterestPoint, Token.tokenCurrent); ListDescriptions = new ObservableCollection <DescriptionWithVote>(listDescriptions); }
static void Main(string[] args) { using (ModuleReader mr = new ModuleReader(@"D:\log4net.dll")) { var module = mr.ReadNetModule(); DescriptionService <HeaderDescriptionInfo> s = new DescriptionService <HeaderDescriptionInfo>(); var md = s.GetFieldDescription(module).ToList(); foreach (var m in md.OrderBy(n => n.HeaderOrderNumber)) { Console.WriteLine($"HeaderOrderNumber {m.HeaderOrderNumber}"); Console.WriteLine($"Header description: {m.Description}"); foreach (var hm in m.HeaderMemberDescriptions.OrderBy(n => n.FieldOffset)) { Console.WriteLine($"FieldName : {hm.FieldName}"); Console.WriteLine($"FieldOffset : {hm.FieldOffset}"); Console.WriteLine($"FieldLength : {hm.FieldLength}"); Console.WriteLine($"FieldValue : {hm.FieldValue}"); Console.Write("Bytes : "); foreach (var b in hm.ValueBytes) { Console.Write($"{b};"); } Console.WriteLine(); Console.WriteLine($"Description : {hm.Description}"); Console.WriteLine(hm.Description); } Console.WriteLine(); } Console.Read(); } }
//Get: Description/Delete public ActionResult Delete(int id) { var service = new DescriptionService(); var description = service.GetDescription(id); return(View(description)); }
// GET: Description Index public ActionResult Index() { var service = new DescriptionService(); var model = service.GetDescriptions(); return(View(model)); }
public async Task ReturnsBadRequestIfPokemonDoesNotExist(string name) { DescriptionService .Setup(s => s.GetShakespeareanDescription(It.IsAny <string>())) .ReturnsAsync(new Monad <string>(new KeyNotFoundException())); var result = await Controller.GetShakespeareanDescription(name); Assert.IsType <BadRequestObjectResult>(result); }
public EventDescription PostSave(EventDescription description) { if (description.Id > 0) { return(DescriptionService.UpdateDescription(description)); } else { return(DescriptionService.CreateDescription(description)); } }
public async Task ThrowsOnIllegalResult() { DescriptionService .Setup(s => s.GetShakespeareanDescription(It.IsAny <string>())) .ReturnsAsync(new Monad <string>(result: null !)); var exception = await Assert.ThrowsAsync <InvalidOperationException>( async() => await Controller.GetShakespeareanDescription("mew")); Assert.Null(exception.InnerException); }
public override IEnumerable<HeaderMemberDescriptionInfo> GetPropertyDescriptionInfo<T>(PropertyInfo property, Attribute attribute, T header) { int dataDirectoriesOffset = GetOffset(attribute); var headerDescriptionService = new DescriptionService<HeaderMemberDescriptionInfo>(); var propertyToGetDescription = property.GetValue(header); foreach (var headerDescription in headerDescriptionService.GetFieldDescription(propertyToGetDescription)) { headerDescription.FieldOffset += dataDirectoriesOffset; yield return headerDescription; } }
public async Task ReturnsTooManyRequestsIfAnyLimitIsExceeded(string name) { DescriptionService .Setup(s => s.GetShakespeareanDescription(It.IsAny <string>())) .ReturnsAsync(new Monad <string>(new LimitExceededException())); var result = await Controller.GetShakespeareanDescription(name); var statusCodeResult = Assert.IsType <StatusCodeResult>(result); Assert.Equal(StatusCodes.Status429TooManyRequests, statusCodeResult.StatusCode); }
public async Task PokemonNameIsAlwaysPassedLowercase(string name) { DescriptionService #pragma warning disable CA1308 // We actually want ToLowerInvariant .Setup(s => s.GetShakespeareanDescription(name.ToLowerInvariant())) #pragma warning restore CA1308 .ReturnsAsync(new Monad <string>("Dummy")) .Verifiable(); var result = await Controller.GetShakespeareanDescription(name); DescriptionService.VerifyAll(); }
//Get: Description/Edit/{id} public ActionResult Edit(int id) { var service = new DescriptionService(); var detail = service.GetDescription(id); var model = new DescriptionEdit { DescriptionId = detail.DescriptionId, DescriptionName = detail.DescriptionName, }; return(View(model)); }
public async Task ReturnedNameMatchesParameter(string name, string description) { DescriptionService .Setup(s => s.GetShakespeareanDescription(It.IsAny <string>())) .ReturnsAsync(new Monad <string>(description)); var result = await Controller.GetShakespeareanDescription(name); var okResult = Assert.IsType <OkObjectResult>(result); var response = Assert.IsType <PokemonResponse>(okResult.Value); Assert.Equal(name, response.Name); }
public async Task ThrowsOnUnexpectedError() { var expected = new ArgumentException(); DescriptionService .Setup(s => s.GetShakespeareanDescription(It.IsAny <string>())) .ReturnsAsync(new Monad <string>(expected)); var exception = await Assert.ThrowsAsync <InvalidOperationException>( async() => await Controller.GetShakespeareanDescription("mew")); Assert.Same(expected, exception.InnerException); }
public ActionResult DeletePost(int id) { var service = new DescriptionService(); if (service.DeleteDescription(id)) { TempData["SaveResult"] = "Description Deleted"; return(RedirectToAction("Index")); } ModelState.AddModelError("", "Description could not be updated"); var model = service.GetDescription(id); return(View(model)); }
public override IEnumerable <HeaderDescriptionInfo> GetPropertyDescriptionInfo <T>(PropertyInfo property, Attribute attribute, T header) { int headerOrderNumber = GetOrderNumber(attribute); string description = GetDescription(attribute); var headerDescriptionService = new DescriptionService <HeaderMemberDescriptionInfo>(); var propertyToGetDescription = property.GetValue(header); IEnumerable <HeaderMemberDescriptionInfo> headerMemberDescriptions = headerDescriptionService.GetFieldDescription(propertyToGetDescription); yield return(new HeaderDescriptionInfo { Description = description, HeaderMemberDescriptions = headerMemberDescriptions, HeaderOrderNumber = headerOrderNumber, }); }
public async Task DeleteDescriptionAsync() { var service = new DescriptionService(); int resultCode = await service.DeleteDescriptionById(SelectedDescription.Description.IdDescription, Token.tokenCurrent); if (resultCode == 200) { MessengerInstance.Send <DescriptionWithVote>(SelectedDescription, "deleteDescription"); } else { var messageDialog = new Windows.UI.Popups.MessageDialog("L'élément à supprimer est introuvable"); await messageDialog.ShowAsync(); } _navigationService.GoBack(); }
public ActionResult Edit(int id, DescriptionEdit model) { var service = new DescriptionService(); if (!ModelState.IsValid) { return(View(model)); } if (service.UpdateDescription(id, model)) { TempData["SaveResult"] = "Description Updated"; return(RedirectToAction("Index")); } ModelState.AddModelError("", "Description could not be updated"); return(View(model)); }
public ActionResult Create(DescriptionCreate model) { if (!ModelState.IsValid) { return(View(model)); } var service = new DescriptionService(); if (service.CreateDescription(model)) { TempData["SaveResult"] = "Description Created"; return(RedirectToAction("Index")); } ModelState.AddModelError("", "Description could not be added"); return(View(model)); }
public IEnumerable <EventDescription> GetAll() { return(DescriptionService.GetAllDescriptions()); }
public EventDescription GetById(int id) { return(DescriptionService.GetDescriptionById(id)); }
public int DeleteById(int id) { return(DescriptionService.DeleteDescription(id)); }
public ActionResult About() { this.ViewBag.Message = DescriptionService.GetWebApplicationDescription(); return(View()); }