示例#1
0
        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);
        }
示例#2
0
        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!");
        }
示例#3
0
        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);
        }
示例#4
0
        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);
        }
示例#5
0
        private BirdRegistration ValidateEggs(BirdRegistration bird)
        {
            bird = ClutchEgg.AreEggsValid(bird);
            Assert.IsNotNull(bird);

            return(bird);
        }
示例#6
0
        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;
        }
示例#8
0
        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);
        }
示例#9
0
        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);
        }
示例#10
0
 public void LoadApplication()
 {
     //const int RingApplicationId = 2625;
     _birdReg = new BirdRegistration(BirdRegistrationApplicationId);
     Assert.IsNotNull(_birdReg);
 }
示例#11
0
        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);
        }