示例#1
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_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 -------------------------        
		}