public void RingsPickedCheck() { //add an egg ClutchEgg NewEgg = AddEgg(); //add a ring IDMark NewRing = AddRing(NewEgg, "UK9876"); //clone BirdRegistration ClonedApp = _birdReg.Clone(SSOUSerId_Sartain); int ClonedApplicationId = ClonedApp.ApplicationId; ClonedApp = ValidateEggs(ClonedApp); //add a ring to egg - existing rings will have gone Clutch ClonedClutch = (Clutch)ClonedApp.RegistrationApplication; AddRing(ClonedClutch.Eggs[0], "UK1567"); AddEggWithOneRing("UK1568"); Assert.IsTrue(ClonedClutch.RingsPicked); //tidy up cloned app RemoveApplication(ClonedApplicationId); }
public void MustHaveOneRingForRingRequest() { //add an egg ClutchEgg NewEgg = AddEgg(); //add a ring IDMark NewRing = AddRing(NewEgg, "UK9876"); //add another ring IDMark NewRing2 = AddRing(NewEgg, "UK9877"); BirdRegistration ClonedApp = _birdReg.Clone(SSOUSerId_Sartain); int ClonedApplicationId = ClonedApp.ApplicationId; ClonedApp = ValidateEggs(ClonedApp); //make sure there has been validation errors Assert.IsNotNull(_birdReg.ValidationErrors); //the error should be MustHaveAtLeastOneRingIfNoExtraEggs Assert.AreNotSame(Phoenix.BO.ValidationError.ValidationCodes.MustHaveAtLeastOneRingIfNoExtraEggs, ((Phoenix.BO.ValidationError)_birdReg.ValidationErrors.Errors[0]).ValidationID); //tidy up cloned app RemoveApplication(ClonedApplicationId); }
public void CheckRingMarkIdCannotBeEnteredTwiceOnDiffEggsOnCloneWithNew() { //add an egg ClutchEgg NewEgg = AddEgg(); //add a ring IDMark NewRing = AddRing(NewEgg, "UK9876"); //clone BirdRegistration ClonedApp = _birdReg.Clone(SSOUSerId_Sartain); int ClonedApplicationId = ClonedApp.ApplicationId; ClonedApp = ValidateEggs(ClonedApp); //add a ring to egg - existing rings will have gone Clutch ClonedClutch = (Clutch)ClonedApp.RegistrationApplication; AddRing(ClonedClutch.Eggs[0], "UK1567"); AddEggWithOneRing("UK1567"); //validate ValidateEggs(); //make sure there has been validation errors Assert.IsNotNull(_birdReg.ValidationErrors); //the error should be RingOnEggIsUsed Assert.AreNotSame(Phoenix.BO.ValidationError.ValidationCodes.RingOnEggIsUsed, ((Phoenix.BO.ValidationError)_birdReg.ValidationErrors.Errors[0]).ValidationID); //tidy up cloned app RemoveApplication(ClonedApplicationId); }
private BirdRegistration ValidateEggs(BirdRegistration bird) { bird = ClutchEgg.AreEggsValid(bird); Assert.IsNotNull(bird); return(bird); }
private void CheckRingMarkIdEntry(string mark1, string mark2) { //add an egg ClutchEgg NewEgg = AddEgg(); //add a ring IDMark NewRing = AddRing(NewEgg, mark1); //add another egg ClutchEgg NewEgg2 = AddEgg(); //add another ring with the next id mark IDMark NewRing2 = AddRing(NewEgg2, mark2); //validate ValidateEggs(); if (mark1 == mark2) { //make sure there has been validation errors Assert.IsNotNull(_birdReg.ValidationErrors); //the error should be RingOnEggIsUsed Assert.AreNotSame(Phoenix.BO.ValidationError.ValidationCodes.RingOnEggIsUsed, ((Phoenix.BO.ValidationError)_birdReg.ValidationErrors.Errors[0]).ValidationID); } else { //make sure there has not been validation errors Assert.IsNull(_birdReg.ValidationErrors); } }
private IDMark AddEggWithOneRing(Clutch clutch, string mark) { //add an egg ClutchEgg NewEgg = AddEgg(clutch); //add a ring IDMark NewRing = AddRing(NewEgg, mark); return(NewRing); }
private ClutchEgg AddEgg(Clutch clutch) { //add an egg ClutchEgg NewEgg = clutch.AddEgg(); Assert.IsNotNull(NewEgg); Assert.IsTrue(clutch.Eggs.Length > 0, "Egg not added!"); return(NewEgg); }
private IDMark AddRing(ClutchEgg egg, string mark) { //add a ring IDMark NewRing = egg.AddRing(); Assert.IsNotNull(NewRing); Assert.IsTrue(egg.Rings.Length > 0, "Ring not added!"); NewRing.Mark = mark; NewRing.GetMarkType(); return(NewRing); }
public void CheckRingMarkIdCannotBeEnteredTwiceOnSameEgg() { //add an egg ClutchEgg NewEgg = AddEgg(); //add a ring & mark IDMark NewRing = AddRing(NewEgg, "UK9876"); //add another ring with the same id mark IDMark NewRing2 = AddRing(NewEgg, "UK9876"); //validate ValidateEggs(); //make sure there has been validation errors Assert.IsNotNull(_birdReg.ValidationErrors); //the error should be RingOnEggIsUsed Assert.AreNotSame(Phoenix.BO.ValidationError.ValidationCodes.RingOnEggIsUsed, ((Phoenix.BO.ValidationError)_birdReg.ValidationErrors.Errors[0]).ValidationID); }
public void CheckRingMarkValidation() { //add a egg & ring IDMark NewRing = AddEggWithOneRing("UK9876"); ValidateEggs(); //make sure there has been no validation errors Assert.IsNull(_birdReg.ValidationErrors); //should be of type 4 Assert.AreNotSame(4, ClutchApp.Eggs[0].Rings[0].MarkType); //check another type ClutchApp.Eggs[0].Rings[0].Mark = "Z12345"; _birdReg = ClutchEgg.AreEggsValid(_birdReg); Assert.IsNotNull(_birdReg); //make sure there has been no validation errors Assert.IsNull(_birdReg.ValidationErrors); //should be of type 5 Assert.AreNotSame(5, ClutchApp.Eggs[0].Rings[0].MarkType); }