public void ShouldRenderTraingOptionsText() { var detail = new FilterProviders(); var model = new DeliveryModeViewModel[3]; var first = new DeliveryModeViewModel { Checked = true, Value = "dayrelease", Count = 35, Title = "day release" }; var second = new DeliveryModeViewModel { Checked = true, Value = "blockrelease", Count = 0, Title = "block release" }; var third = new DeliveryModeViewModel { Checked = true, Value = "100percentemployer", Count = 28, Title = "at your location" }; model[0] = first; model[1] = second; model[2] = third; var html = detail.RenderAsHtml(model).ToAngleSharp(); var result1 = GetPartial(html, "label", 1); var result2 = GetPartial(html, "label", 2); var result3 = GetPartial(html, "label", 3); result1.Should().Be("day release (35)"); result2.Should().Be("block release (0)"); result3.Should().Be("at your location (28)"); }
// // GET: /DeliveryMode/ public ActionResult Index() { var model = new DeliveryModeViewModel(); model.Populate(db); return(View(model)); }
public void ShouldRenderTraingOptionsInputs() { var detail = new FilterProviders(); var model = new DeliveryModeViewModel[3]; var first = new DeliveryModeViewModel { Checked = true, Value = "dayrelease", Count = 35, Title = "day release" }; var second = new DeliveryModeViewModel { Checked = true, Value = "blockrelease", Count = 0, Title = "block release" }; var third = new DeliveryModeViewModel { Checked = true, Value = "100percentemployer", Count = 28, Title = "at your location" }; model[0] = first; model[1] = second; model[2] = third; var html = detail.RenderAsHtml(model).ToAngleSharp(); var result1 = GetHtmlElement(html, "input", 1); var result2 = GetHtmlElement(html, "input", 2); var result3 = GetHtmlElement(html, "input", 3); result1.Attributes["value"].Value.Should().Be("dayrelease"); result2.Attributes["value"].Value.Should().Be("blockrelease"); result3.Attributes["value"].Value.Should().Be("100percentemployer"); }
public ViewDeliveryMode() { InitializeComponent(); DeliveryModeViewModel _DMVM = new DeliveryModeViewModel(); _DMVM.GetDeliveryModeList(); this.DataContext = _DMVM; }
public DeliveryMode() { InitializeComponent(); DeliveryModeViewModel dmvm = new DeliveryModeViewModel(); this.DataContext = dmvm; }
public async Task <IActionResult> Edit(DeliveryModeViewModel model, CancellationToken token) { var entity = await _context.DeliveryModes .Where(c => c.Id == model.Id) .SingleOrDefaultAsync(token); var result = await _mediatr.Process(new UpdateDeliveryModeCommand(new RequestUser() { Id = entity.ProducerId }) { DeliveryModeId = model.Id, Description = model.Description, Name = model.Name, Address = _mapper.Map <AddressDto>(model.Address), Kind = model.Kind, Available = model.Available, MaxPurchaseOrdersPerTimeSlot = model.MaxPurchaseOrdersPerTimeSlot, AutoAcceptRelatedPurchaseOrder = model.AutoAcceptRelatedPurchaseOrder, AutoCompleteRelatedPurchaseOrder = model.AutoCompleteRelatedPurchaseOrder, LockOrderHoursBeforeDelivery = model.LockOrderHoursBeforeDelivery, Closings = model.Closings? .Where(d => !d.Remove && d.ClosedFrom.HasValue && d.ClosedTo.HasValue) .Select(c => new ClosingInputDto { Id = c.Id, From = c.ClosedFrom.Value, To = c.ClosedTo.Value, Reason = c.Reason }), Agreements = model.Agreements? .Select(p => new AgreementPositionDto { Id = p.Id, Position = p.Position }), DeliveryHours = model.DeliveryHours? .Where(d => !d.Remove && d.Day.HasValue && d.From.HasValue && d.To.HasValue) .GroupBy(d => new { d.From, d.To }) .Select(d => new TimeSlotGroupDto { Days = d.Select(e => e.Day.Value).ToList(), From = d.Key.From.Value, To = d.Key.To.Value }), }, token); if (!result.Succeeded) { ModelState.AddModelError("", result.Exception.Message); return(View(model)); } return(RedirectToAction("Edit", new { model.Id })); }
public void Then_Maps_Fields_From_Source(DeliveryMode source) { var actual = new DeliveryModeViewModel().Map(source, DeliveryModeType.BlockRelease); actual.Should().BeEquivalentTo(source, options => options .Excluding(c => c.DeliveryModeType) .Excluding(c => c.DistanceInMiles) ); actual.AddressFormatted.Should() .Be($"{source.Address1}, {source.Address2}, {source.Town}, {source.County}, {source.Postcode}"); }
public void ShouldRenderInfoBox() { var detail = new FilterProviders(); var model = new DeliveryModeViewModel[0]; var html = detail.RenderAsHtml(model).ToAngleSharp(); var summary = GetPartial(html, "details summary"); summary.Should().Be("Explain training options"); }
public void Then_Builds_Address_Correctly(string address1, string address2, string town, string county, string postcode, string expected, DeliveryMode source) { source.Address1 = address1; source.Address2 = address2; source.County = county; source.Postcode = postcode; source.Town = town; var actual = new DeliveryModeViewModel().Map(source, DeliveryModeType.BlockRelease); actual.AddressFormatted.Should().Be(expected); }