Пример #1
0
        public static void CleanUpContactPersonNumberGenerator_ForInMemory()
        {
            ContactPersonWithNumberGenerator.LoadDefaultClassDef();
            BOSequenceNumber.LoadNumberGenClassDef();
            INumberGenerator numGen = new NumberGenerator("GeneratedNumber");

            numGen.SetSequenceNumber(0);
        }
Пример #2
0
        public void TestAcceptance_NumberGeneratorCreatedInBeforeUpdateForAnObject()
        {
            //---------------Clean Up --------------------------
//            CleanUpContactPersonNumberGenerator();
            BORegistry.DataAccessor = new DataAccessorInMemory();
            CleanUpContactPersonNumberGenerator_ForInMemory();
            //---------------Set up test pack-------------------
            //Create an object that sets the number generator for it.
            //Edit the object.
            ContactPersonWithNumberGenerator cp = new ContactPersonWithNumberGenerator();

            cp.Surname = Guid.NewGuid().ToString();
            //---------------Execute Test ----------------------
            //save the object
            cp.Save();
            //---------------Test Result -----------------------
            //check that the object has its number set to the appropriate value.
            Assert.AreEqual("1", cp.GeneratedNumber);
            //---------------Tear Down -------------------------
        }
        public void TestAcceptance_NumberGeneratorCreatedInBeforeUpdateForAnObject_2ObjectsInTransaction()
        {
            //---------------Set up test pack-------------------
            //Create an object that sets the number generator for it.
            //            CleanUpContactPersonNumberGenerator();
            BORegistry.DataAccessor = new DataAccessorInMemory();
            TestNumberGenerator.CleanUpContactPersonNumberGenerator_ForInMemory();
            //---------------Set up test pack-------------------
            //Create an objects that sets the number generator for it.
            //Edit the objects.
            var cp = new ContactPersonWithNumberGenerator();
            cp.Surname = Guid.NewGuid().ToString();
            var cp2 = new ContactPersonWithNumberGenerator();
            cp2.Surname = Guid.NewGuid().ToString();
            //---------------Execute Test ----------------------
            //Add the objects 
            TransactionCommitterStubDB trnCommit = new TransactionCommitterStubDB(DatabaseConnection.CurrentConnection);
            trnCommit.AddBusinessObject(cp);
            trnCommit.AddBusinessObject(cp2);
            trnCommit.CommitTransaction();

            //---------------Test Result -----------------------
            //check that the objects have its number set to the appropriate value.
            Assert.AreEqual("1", cp.GeneratedNumber);
            Assert.AreEqual("2", cp2.GeneratedNumber);
            //---------------Tear Down -------------------------        
        }
Пример #4
0
		public void TestAcceptance_NumberGeneratorCreatedInBeforeUpdateForAnObject_2ObjectsSavedOneAfterTheOther()
		{
			//---------------Clean Up --------------------------
			BORegistry.DataAccessor = new DataAccessorInMemory();
			CleanUpContactPersonNumberGenerator_ForInMemory();
			//---------------Set up test pack-------------------
			//Create an object that sets the number generator for it.
			//Edit the object.
			ContactPersonWithNumberGenerator cp = new ContactPersonWithNumberGenerator();
			cp.Surname = Guid.NewGuid().ToString();

			//---------------Execute Test ----------------------
			cp.Save();            
			ContactPersonWithNumberGenerator cp2 = new ContactPersonWithNumberGenerator();
			cp2.Surname = Guid.NewGuid().ToString();
			cp2.Save();
			//---------------Test Result -----------------------
			//check that the object has its number set to the appropriate value.
			Assert.AreEqual("2", cp2.GeneratedNumber);
			//---------------Tear Down -------------------------        
		}