public void CanAddWasteTypeForSrf() { notification.SetWasteType(WasteType.CreateSrfWasteType(GetWasteAdditionalInformationCollection())); Assert.True(notification.HasWasteType); Assert.Equal(5, notification.WasteType.WasteAdditionalInformation.Count()); }
private static ImportNotificationSummary CreateImportNotifiationSummary(ImportNotificationStatus status) { var wasteType = new WasteType() { EwcCodes = new WasteCodeSelection() { WasteCodes = CreateEwcCodes() }, YCodes = new WasteCodeSelection() { WasteCodes = CreateYCodes() }, HCodes = new WasteCodeSelection() { WasteCodes = CreateHCodes() }, UnClasses = new WasteCodeSelection() { WasteCodes = CreateUnClasses() } }; var summary = new ImportNotificationSummary() { Id = Guid.NewGuid(), Type = NotificationType.Recovery, Status = status, Number = "GB123", WasteType = wasteType }; return(summary); }
public void ValidWasteTypeWithCodes_HasNoValidationErrors() { var validWasteType = new WasteType(AnyGuid) { Name = "Waste", SelectedBaselCode = Guid.NewGuid(), SelectedEwcCodes = new List <Guid>() { Guid.NewGuid() }, SelectedHCodes = new List <Guid>() { Guid.NewGuid() }, SelectedUnClasses = new List <Guid>() { Guid.NewGuid() }, SelectedYCodes = new List <Guid>() { Guid.NewGuid() }, }; var result = validator.Validate(validWasteType); Assert.True(result.IsValid); }
//ProcessGarbage {name}|{weight}|{volumePerKg}|{type} protected Waste(string name, double weight, double volumePerKg, WasteType type) { this.Name = name; this.Weight = weight; this.VolumePerKg = volumePerKg; this.type = type; }
public void CanEditWasteAdditionalInformation() { notification.SetWasteType(WasteType.CreateSrfWasteType(GetWasteAdditionalInformationCollection())); notification.SetWasteAdditionalInformation(GetWasteAdditionalInformationCollection()); List <WasteAdditionalInformation> editedWasteAdditionalInformation = new List <WasteAdditionalInformation>(); editedWasteAdditionalInformation.Add(WasteAdditionalInformation.CreateWasteAdditionalInformation("First Constituent", 50, 100, WasteInformationType.AshContent)); editedWasteAdditionalInformation.Add(WasteAdditionalInformation.CreateWasteAdditionalInformation("Second Constituent", 50, 100, WasteInformationType.Chlorine)); editedWasteAdditionalInformation.Add(WasteAdditionalInformation.CreateWasteAdditionalInformation("Third Constituent", 50, 100, WasteInformationType.Energy)); editedWasteAdditionalInformation.Add(WasteAdditionalInformation.CreateWasteAdditionalInformation("Fourth Constituent", 50, 100, WasteInformationType.HeavyMetals)); editedWasteAdditionalInformation.Add(WasteAdditionalInformation.CreateWasteAdditionalInformation("Fifth Constituent", 50, 100, WasteInformationType.MoistureContent)); editedWasteAdditionalInformation.Add(WasteAdditionalInformation.CreateWasteAdditionalInformation("Sixth Constituent", 50, 100, WasteInformationType.NetCalorificValue)); notification.SetWasteAdditionalInformation(editedWasteAdditionalInformation); Assert.Collection(notification.WasteType.WasteAdditionalInformation, item => Assert.Equal(50, notification.WasteType.WasteAdditionalInformation.Single(p => p.Constituent == "First Constituent").MinConcentration), item => Assert.Equal(50, notification.WasteType.WasteAdditionalInformation.Single(p => p.Constituent == "Second Constituent").MinConcentration), item => Assert.Equal(50, notification.WasteType.WasteAdditionalInformation.Single(p => p.Constituent == "Third Constituent").MinConcentration), item => Assert.Equal(50, notification.WasteType.WasteAdditionalInformation.Single(p => p.Constituent == "Fourth Constituent").MinConcentration), item => Assert.Equal(50, notification.WasteType.WasteAdditionalInformation.Single(p => p.Constituent == "Fifth Constituent").MinConcentration), item => Assert.Equal(50, notification.WasteType.WasteAdditionalInformation.Single(p => p.Constituent == "Sixth Constituent").MinConcentration)); }
public void SpawnObject(WasteType wasteType) { int i = Random.Range(0, spawnPoint.Length); Waste t = Instantiate(WasteObjects[(int)wasteType], spawnPoint[i].transform.position, WasteObjects[(int)wasteType].transform.rotation).GetComponent <Waste>(); t.StartingPippe = spawnPoint[i].GetComponent <PipeInfo>().pipe; }
public void InvalidName_HasValidationError(string input) { var wasteType = new WasteType(AnyGuid); wasteType.Name = input; validator.ShouldHaveValidationErrorFor(x => x.Name, wasteType); }
public IHttpActionResult PutWasteType(int id, WasteType wasteType) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != wasteType.WasteTypeId) { return(BadRequest()); } db.Entry(wasteType).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!WasteTypeExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public ActionResult DeleteConfirmed(int id) { WasteType wasteType = db.WasteTypes.Find(id); db.WasteTypes.Remove(wasteType); db.SaveChanges(); return(RedirectToAction("Index")); }
public void CanChangeChemicalCompositionType() { notification.SetWasteType(WasteType.CreateWoodWasteType("some description", GetWoodWasteTypeCollection())); notification.SetWasteType(WasteType.CreateSrfWasteType(GetWasteAdditionalInformationCollection())); Assert.Equal(ChemicalComposition.SRF, notification.WasteType.ChemicalCompositionType); }
public void InvalidSelectedEwcCodes_HasValidationError() { var wasteType = new WasteType(AnyGuid) { SelectedEwcCodes = new List <Guid>() }; validator.ShouldHaveValidationErrorFor(x => x.SelectedEwcCodes, wasteType); }
public string GetOptionalInformationTitle(WasteType wasteType) { if (wasteType != null && !string.IsNullOrWhiteSpace(wasteType.OptionalInformation)) { return(Environment.NewLine + "Additional Information" + Environment.NewLine + wasteType.OptionalInformation + Environment.NewLine); } return(string.Empty); }
public string GetEnergyEfficiencyString(WasteType wasteType) { if (wasteType == null || string.IsNullOrWhiteSpace(wasteType.EnergyInformation)) { return(string.Empty); } return(Environment.NewLine + "Energy Efficiency = " + wasteType.EnergyInformation); }
public void InvalidSelectedEwcCodes_HasValidationError() { var wasteType = new WasteType(AnyGuid) { SelectedEwcCodes = new List<Guid>() }; validator.ShouldHaveValidationErrorFor(x => x.SelectedEwcCodes, wasteType); }
public void InvalidSelectedBaselCode_HasValidationError() { var wasteType = new WasteType(AnyGuid) { BaselCodeNotListed = false, SelectedBaselCode = null }; validator.ShouldHaveValidationErrorFor(x => x.SelectedBaselCode, wasteType); }
public void InvalidSelectedYCodes_HasValidationError() { var wasteType = new WasteType(AnyGuid) { YCodeNotApplicable = false, SelectedYCodes = new List <Guid>() }; validator.ShouldHaveValidationErrorFor(x => x.SelectedYCodes, wasteType); }
public void BaselCodeNotListed_HasNoValidationError() { var wasteType = new WasteType(AnyGuid) { BaselCodeNotListed = true, SelectedBaselCode = null }; validator.ShouldNotHaveValidationErrorFor(x => x.SelectedBaselCode, wasteType); }
public void YCodeNotApplicable_HasNoValidationError() { var wasteType = new WasteType(AnyGuid) { YCodeNotApplicable = true, SelectedYCodes = new List <Guid>() }; validator.ShouldNotHaveValidationErrorFor(x => x.SelectedYCodes, wasteType); }
public IHttpActionResult GetWasteType(int id) { WasteType wasteType = db.WasteTypes.Find(id); if (wasteType == null) { return(NotFound()); } return(Ok(wasteType)); }
public ActionResult Edit([Bind(Include = "WasteTypeId,WasteTypeName,UserTypeId,Status")] WasteType wasteType) { if (ModelState.IsValid) { db.Entry(wasteType).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.UserTypeId = new SelectList(db.UserTypes, "UserTypeId", "UserTypeName", wasteType.UserTypeId); return(View(wasteType)); }
public IHttpActionResult PostWasteType(WasteType wasteType) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.WasteTypes.Add(wasteType); db.SaveChanges(); return(CreatedAtRoute("DefaultApi", new { id = wasteType.WasteTypeId }, wasteType)); }
public ActionResult Create([Bind(Include = "WasteTypeId,WasteTypeName,UserTypeId,Status")] WasteType wasteType) { if (ModelState.IsValid) { db.WasteTypes.Add(wasteType); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.UserTypeId = new SelectList(db.UserTypes, "UserTypeId", "UserTypeName", wasteType.UserTypeId); return(View(wasteType)); }
/// <summary> /// /// </summary> /// <param name="args"></param> static void Main(string[] args) { using (var uow = new UnitOfWork <SystemContext>()) { Random rnd = new Random(); uow.GetRepository <Person>() .Add(new Person { FirstName = "Sofia", LastName = "Ratia", }); uow.GetRepository <Person>() .Add(new Person { FirstName = "Sofia", LastName = "Ratia", }); uow.GetRepository <Person>() .Add(new Person { FirstName = "Camila", LastName = "Canaval", }); uow.GetRepository <WasteType>() .Add( new WasteType { Description = "DESPERDICIO POLLO", } ); if (uow.Commit() > 0) { Console.WriteLine("Successfully saved data.......!!!!!"); } WasteType dataupdate = uow .GetRepository <WasteType>() .Find(wt => wt.Description == "DESPERDICIO BOVINO"); if (dataupdate != null) { dataupdate.Description = "_DESPERDICIO_BOVINO_"; uow.GetRepository <WasteType>() .Update(dataupdate); if (uow.Commit() > 0) { Console.WriteLine("Successfully updated data.......!!!!!"); } } } Console.ReadKey(); }
// GET: WasteTypes/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } WasteType wasteType = db.WasteTypes.Include(u => u.UserType).Include(u => u.UserType.Plant).Include(u => u.UserType.Plant.Company).Include(u => u.UserType.Plant.Company.Country).SingleOrDefault(x => x.WasteTypeId == id); if (wasteType == null) { return(HttpNotFound()); } return(View(wasteType)); }
// GET: WasteTypes/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } WasteType wasteType = db.WasteTypes.Find(id); if (wasteType == null) { return(HttpNotFound()); } return(View(wasteType)); }
public IHttpActionResult DeleteWasteType(int id) { WasteType wasteType = db.WasteTypes.Find(id); if (wasteType == null) { return(NotFound()); } db.WasteTypes.Remove(wasteType); db.SaveChanges(); return(Ok(wasteType)); }
public WasteCodesViewModel(WasteType data) { Name = data.Name; BaselCodeNotListed = data.BaselCodeNotListed; SelectedBaselCode = data.SelectedBaselCode; YCodeNotApplicable = data.YCodeNotApplicable; HCodeNotApplicable = data.HCodeNotApplicable; UnClassNotApplicable = data.UnClassNotApplicable; SelectedEwcCodesDisplay = new List <WasteCodeViewModel>(); SelectedYCodesDisplay = new List <WasteCodeViewModel>(); SelectedHCodesDisplay = new List <WasteCodeViewModel>(); SelectedUnClassesDisplay = new List <WasteCodeViewModel>(); }
public WasteCodesViewModel(WasteType data) { Name = data.Name; BaselCodeNotListed = data.BaselCodeNotListed; SelectedBaselCode = data.SelectedBaselCode; YCodeNotApplicable = data.YCodeNotApplicable; HCodeNotApplicable = data.HCodeNotApplicable; UnClassNotApplicable = data.UnClassNotApplicable; SelectedEwcCodesDisplay = new List<WasteCodeViewModel>(); SelectedYCodesDisplay = new List<WasteCodeViewModel>(); SelectedHCodesDisplay = new List<WasteCodeViewModel>(); SelectedUnClassesDisplay = new List<WasteCodeViewModel>(); }
// GET: WasteTypes/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } WasteType wasteType = db.WasteTypes.Include(u => u.UserType).Include(u => u.UserType.Plant).Include(u => u.UserType.Plant.Company).Include(u => u.UserType.Plant.Company.Country).SingleOrDefault(x => x.WasteTypeId == id); if (wasteType == null) { return(HttpNotFound()); } ViewBag.UserTypeId = new SelectList(db.UserTypes, "UserTypeId", "UserTypeName", wasteType.UserTypeId); return(View(wasteType)); }
public void ValidWasteTypeWithoutCodes_HasNoValidationErrors() { var validWasteType = new WasteType(AnyGuid) { Name = "Waste", SelectedEwcCodes = new List<Guid> { Guid.NewGuid() }, BaselCodeNotListed = true, HCodeNotApplicable = true, UnClassNotApplicable = true, YCodeNotApplicable = true }; var result = validator.Validate(validWasteType); Assert.True(result.IsValid); }
public void ValidWasteTypeWithCodes_HasNoValidationErrors() { var validWasteType = new WasteType(AnyGuid) { Name = "Waste", SelectedBaselCode = Guid.NewGuid(), SelectedEwcCodes = new List<Guid>() { Guid.NewGuid() }, SelectedHCodes = new List<Guid>() { Guid.NewGuid() }, SelectedUnClasses = new List<Guid>() { Guid.NewGuid() }, SelectedYCodes = new List<Guid>() { Guid.NewGuid() }, }; var result = validator.Validate(validWasteType); Assert.True(result.IsValid); }
public WasteCompositionViewModel(WasteType wasteType, WasteCompositionFormatter formatter) { WasteName = formatter.GetWasteName(wasteType); Energy = formatter.GetEnergyEfficiencyString(wasteType); OptionalInformation = formatter.GetOptionalInformationTitle(wasteType); HasAnnex = wasteType.HasAnnex; SetWasteTypeDescription(wasteType); ChemicalComposition = wasteType.ChemicalCompositionType; Compositions = formatter.GetWasteCompositionPercentages(wasteType); AdditionalInfos = formatter.GetAdditionalInformationChemicalCompositionPercentages(wasteType.WasteAdditionalInformation); SetMergeDescriptionText(); }
public IList<ChemicalCompositionPercentages> GetWasteCompositionPercentages(WasteType wasteType) { if (wasteType == null || wasteType.WasteCompositions == null || !wasteType.WasteCompositions.Any()) { return new ChemicalCompositionPercentages[0]; } return wasteType.WasteCompositions .OrderBy(x => x.ChemicalCompositionType) .Where(x => !(x.MaxConcentration == 0 && x.MinConcentration == 0)) .Select(x => new ChemicalCompositionPercentages { Min = x.MinConcentration.ToString("N"), Max = x.MaxConcentration.ToString("N"), Name = GetConstituentWithUnits(x.Constituent) }).ToArray(); }
public IList <ChemicalCompositionPercentages> GetWasteCompositionPercentages(WasteType wasteType) { if (wasteType == null || wasteType.WasteCompositions == null || !wasteType.WasteCompositions.Any()) { return(new ChemicalCompositionPercentages[0]); } return(wasteType.WasteCompositions .OrderBy(x => x.ChemicalCompositionType) .Where(x => !(x.MaxConcentration == 0 && x.MinConcentration == 0)) .Select(x => new ChemicalCompositionPercentages { Min = x.MinConcentration.ToString("N"), Max = x.MaxConcentration.ToString("N"), Name = GetConstituentWithUnits(x.Constituent) }).ToArray()); }
public void ValidWasteTypeWithoutCodes_HasNoValidationErrors() { var validWasteType = new WasteType(AnyGuid) { Name = "Waste", SelectedEwcCodes = new List <Guid> { Guid.NewGuid() }, BaselCodeNotListed = true, HCodeNotApplicable = true, UnClassNotApplicable = true, YCodeNotApplicable = true }; var result = validator.Validate(validWasteType); Assert.True(result.IsValid); }
public string GetWasteName(WasteType wasteType) { if (wasteType == null) { return string.Empty; } if (wasteType.ChemicalCompositionType == ChemicalComposition.RDF) { return "Refuse Derived Fuel (RDF)"; } if (wasteType.ChemicalCompositionType == ChemicalComposition.SRF) { return "Solid Recovered Fuel (SRF)"; } if (wasteType.ChemicalCompositionType == ChemicalComposition.Wood) { return "Wood"; } return wasteType.ChemicalCompositionName; }
public string GetOptionalInformationTitle(WasteType wasteType) { if (wasteType != null && !string.IsNullOrWhiteSpace(wasteType.OptionalInformation)) { return Environment.NewLine + "Additional Information" + Environment.NewLine + wasteType.OptionalInformation + Environment.NewLine; } return string.Empty; }
public string GetEnergyEfficiencyString(WasteType wasteType) { if (wasteType == null || string.IsNullOrWhiteSpace(wasteType.EnergyInformation)) { return string.Empty; } return Environment.NewLine + "Energy Efficiency = " + wasteType.EnergyInformation; }
public void InvalidSelectedHCodes_HasValidationError() { var wasteType = new WasteType(AnyGuid) { HCodeNotApplicable = false, SelectedHCodes = new List<Guid>() }; validator.ShouldHaveValidationErrorFor(x => x.SelectedHCodes, wasteType); }
private NotificationApplication CreateNotificationApplication(Guid id, UKCompetentAuthority competentAuthority, WasteType wasteType) { var notificationApplication = NotificationApplicationFactory.Create(Guid.NewGuid(), NotificationType.Recovery, competentAuthority, 0); EntityHelper.SetEntityId(notificationApplication, id); notificationApplication.SetWasteType(wasteType); return notificationApplication; }
private void SetWasteTypeDescription(WasteType wasteType) { if (wasteType == null) { return; } if (wasteType.ChemicalCompositionType == ChemicalComposition.Wood) { WoodTypeDescription = wasteType.WoodTypeDescription ?? string.Empty; } else if (wasteType.ChemicalCompositionType == ChemicalComposition.Other) { OtherTypeDescription = wasteType.OtherWasteTypeDescription ?? string.Empty; } else { ChemicalCompositionDescription = wasteType.ChemicalCompositionDescription ?? string.Empty; } }
public void YCodeNotApplicable_HasNoValidationError() { var wasteType = new WasteType(AnyGuid) { YCodeNotApplicable = true, SelectedYCodes = new List<Guid>() }; validator.ShouldNotHaveValidationErrorFor(x => x.SelectedYCodes, wasteType); }
public void Add(WasteType wasteType) { context.WasteTypes.Add(wasteType); }