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 void CheckReload(RegistrationApplicationType appType) { //add specimens _birdReg.RegApplicationType = appType; //create a basebird object BaseBird Bird = _birdReg.RegistrationApplication; //create a specimen AdultSpecimenType Specimen = Bird.AddPolymorphicSpecimen(); Assert.IsTrue(0 < Bird.Specimens.Length, "Specimen not added"); //save the application int ApplicationId = _birdReg.ApplicationId; _birdReg = _birdReg.Save(); Assert.IsNotNull(_birdReg); Console.WriteLine(_birdReg.GetXML()); //reload the application _birdReg = new BirdRegistration(ApplicationId); Assert.IsNotNull(_birdReg); //check to see if the application has specimens //Console.WriteLine(_birdReg.GetXML()); Assert.IsTrue(0 < _birdReg.RegistrationApplication.Specimens.Length, "Specimens not re-loaded!"); }
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); }
private BirdRegistration ValidateEggs(BirdRegistration bird) { bird = ClutchEgg.AreEggsValid(bird); Assert.IsNotNull(bird); return(bird); }
protected virtual BirdRegistration InternalCreateApplication() { const int PartyId = 1; BirdRegistration Result = new BirdRegistration(PartyId, BirdRegLoadMode.LoadByParty, -1, string.Empty); Assert.IsNotNull(Result); return(Result); }
private void button2_Click(object sender, System.EventArgs e) { BirdRegistration NewApp = new BirdRegistration(1, BirdRegLoadMode.LoadByParty, 1275, ""); // BirdRegistration birds = CreateApp(RegistrationApplicationType.Imported); // int OwnerId = birds.OwnerId; // birds.Submit(); // // birds = new BO.Application.Bird.Registration.BirdRegistration(birds.ApplicationId); // int Owner2 = birds.OwnerId; }
protected void RemoveApplication(int applicationId) { //SCS Assert.AreNotEqual(applicationId, 0); Assert.GreaterThan(applicationId, 0); //tidy up the records I created. Could be performed with a transaction instead. Assert.IsTrue(BirdRegistration.Delete(applicationId)); //remove the records from the search table BirdRegistrationSearch.RemoveExistingSearchInfo(applicationId, null); }
public void CheckRingEnterOnAnotherApplicationBeforeDOR() { const string RingMark = "AY1235"; //add a ring AddEggWithOneRing(RingMark); //add a specimen (required to persist ring info) ClutchSpecimen Spec1 = ClutchApp.Eggs[0].CreateSpecimenFrom(ClutchApp); Spec1.SpecimenType = new SpecimenType(BO.Application.GenderType.Male); ValidateEggs(); IDMark NewRing = Spec1.AddRing(ClutchApp.Eggs[0].Rings[0]); NewRing.GetMarkType(); //...and save it _birdReg = _birdReg.Save(); //create another application BirdRegistration NewApp = InternalCreateApplication(); //add a ring & egg Clutch NewClutch = (Clutch)NewApp.RegistrationApplication; AddEggWithOneRing(NewClutch, RingMark); //add a specimen (required to persist ring info) ClutchSpecimen Spec2 = NewClutch.Eggs[0].CreateSpecimenFrom(NewClutch); Spec2.SpecimenType = new SpecimenType(BO.Application.GenderType.Male); ValidateEggs(NewApp); Spec2.AddRing(NewClutch.Eggs[0].Rings[0]); //...and save it NewApp = NewApp.Save(); //check to see if it picks up the ring from the other app NewApp = ValidateEggs(NewApp); //make sure there has been validation errors Assert.IsNotNull(NewApp.ValidationErrors); //tidy up additional app RemoveApplication(NewApp.ApplicationId); }
public void LoadApplication() { //const int RingApplicationId = 2625; _birdReg = new BirdRegistration(BirdRegistrationApplicationId); Assert.IsNotNull(_birdReg); }
public void Clone() { BirdRegistration ClonedApp = _birdReg.Clone(SSOUSerId_Sartain); Assert.IsNotNull(ClonedApp); int ClonedApplicationId = ClonedApp.ApplicationId; //recloning should fail try { ClonedApp.Clone(SSOUSerId_Sartain); Assert.Fail("An application should only be able to be cloned once"); } catch //(Exception ex) { //all is good if we get an exception! } //try to reload the cloned application ClonedApp = new BirdRegistration(ClonedApplicationId); Assert.IsNotNull(ClonedApp); //make sure we have the existing id in this app Assert.AreNotSame(BirdRegistrationApplicationId, ClonedApp.ApplicationId); //make sure we can load the existing from the cloned BirdRegistration ApplicationFromClonedApp = ClonedApp.GetRelatedApplication(); Assert.IsNotNull(ApplicationFromClonedApp); ApplicationFromClonedApp = null; ClonedApp = null; //to reclone we need to reload the parent LoadApplication(); BirdRegistration ClonedApp2 = _birdReg.Clone(SSOUSerId_Sartain); Assert.IsNotNull(ClonedApp2); int ClonedApplicationId2 = ClonedApp2.ApplicationId; //Check that the other app can get to the cloned app LoadApplication(); int[] OtherIds = _birdReg.GetAllApplicationsBasedOnThis(); Assert.IsNotNull(OtherIds); Console.WriteLine(OtherIds.Length.ToString()); Assert.GreaterThan(OtherIds.Length, 0); //SCS Assert.DoAssert(new IsNotEmptyAsserter(OtherIds)); //check if the cloned id is in this list System.Collections.ArrayList ResultList = new System.Collections.ArrayList(OtherIds); Console.WriteLine(ResultList.Count.ToString()); Console.WriteLine(ResultList[0].ToString()); Assert.IsTrue(ResultList.Contains(ClonedApplicationId), "Cloned application doesn't exist in the based on list!"); Assert.IsTrue(ResultList.Contains(ClonedApplicationId2), "Cloned application 2 doesn't exist in the based on list!"); //tidy up cloned app RemoveApplication(ClonedApplicationId); RemoveApplication(ClonedApplicationId2); }