public void TechnologyEmployedCantBeEmpty()
        { 
            var operationCodes = new WasteOperation(importNotificationId, validRCodesList);

            Action setTechnologyEmployed = () => operationCodes.SetTechnologyEmployed(string.Empty);

            Assert.Throws<ArgumentException>("technologyEmployed", setTechnologyEmployed);
        }
예제 #2
0
        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);
        }
예제 #4
0
        public void CanSetTechnologyEmployed()
        {
            var operationCodes = new WasteOperation(importNotificationId, validRCodesList);

            operationCodes.SetTechnologyEmployed("techno");

            Assert.Equal("techno", operationCodes.TechnologyEmployed);
        }
예제 #5
0
        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)));
        }
예제 #6
0
        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;
        }
예제 #8
0
        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);
        }
예제 #11
0
 public void Add(WasteOperation wasteOperation)
 {
     context.OperationCodes.Add(wasteOperation);
 }
예제 #12
0
        public void CanCreateOperationCodes()
        {
            var operationCodes = new WasteOperation(importNotificationId, validRCodesList);

            Assert.IsType <WasteOperation>(operationCodes);
        }