public void TechnologyEmployedCantBeEmpty() { var operationCodes = new WasteOperation(importNotificationId, validRCodesList); Action setTechnologyEmployed = () => operationCodes.SetTechnologyEmployed(string.Empty); Assert.Throws<ArgumentException>("technologyEmployed", setTechnologyEmployed); }
public void SetOperationCodesCantBeNull() { var operationCodes = new WasteOperation(importNotificationId, validRCodesList); Action setOperationCodes = () => operationCodes.SetOperationCodes(null); Assert.Throws <ArgumentNullException>("operationCodes", setOperationCodes); }
public void CanSetTechnologyEmployed() { var operationCodes = new WasteOperation(importNotificationId, validRCodesList); operationCodes.SetTechnologyEmployed("techno"); Assert.Equal("techno", operationCodes.TechnologyEmployed); }
public void CanSetOperationCodes() { var operationCodes = new WasteOperation(importNotificationId, validRCodesList); operationCodes.SetOperationCodes(new List <WasteOperationCode>(anotherValidRCodesList)); Assert.All(operationCodes.Codes, code => Assert.True(anotherValidRCodesList.Any(x => x.OperationCode == code.OperationCode))); }
public WasteOperationViewModel(NotificationDetails details, WasteOperation data) { ImportNotificationId = details.ImportNotificationId; NotificationType = details.NotificationType; var selectedCodes = data.OperationCodes ?? new OperationCode[0]; Codes = OperationCodeMetadata.GetCodesForOperation(details.NotificationType) .Select(c => new KeyValuePairViewModel <OperationCode, bool>(c, selectedCodes.Contains(c))) .ToList(); TechnologyEmployed = data.TechnologyEmployed; }
public WasteOperationViewModel(NotificationDetails details, WasteOperation data) { ImportNotificationId = details.ImportNotificationId; NotificationType = details.NotificationType; var selectedCodes = data.OperationCodes ?? new OperationCode[0]; Codes = OperationCodeMetadata.GetCodesForOperation(details.NotificationType) .Select(c => new KeyValuePairViewModel<OperationCode, bool>(c, selectedCodes.Contains(c))) .ToList(); TechnologyEmployed = data.TechnologyEmployed; }
public async Task <ActionResult> Index(Guid id, WasteOperationViewModel model) { if (!ModelState.IsValid) { return(View(model)); } var wasteOperation = new WasteOperation(id) { OperationCodes = model.SelectedCodes.ToArray(), TechnologyEmployed = model.TechnologyEmployed }; await mediator.SendAsync(new SetDraftData <WasteOperation>(id, wasteOperation)); return(RedirectToAction("Index", "WasteType")); }
public void Add(WasteOperation wasteOperation) { context.OperationCodes.Add(wasteOperation); }
public void CanCreateOperationCodes() { var operationCodes = new WasteOperation(importNotificationId, validRCodesList); Assert.IsType<WasteOperation>(operationCodes); }
public void CanCreateOperationCodes() { var operationCodes = new WasteOperation(importNotificationId, validRCodesList); Assert.IsType <WasteOperation>(operationCodes); }