public void GenerateUserAndContainerSnapshotTest()
		{
			TestRoleData roleData = SCObjectGenerator.PrepareTestRoleWithOrgAndGroup();

			SCConditionCalculator calculator = new SCConditionCalculator();

			ProcessProgress.Clear();
			ProcessProgress.Current.RegisterResponser(TestProgressResponser.Instance);

			calculator.GenerateUserAndContainerSnapshot(new List<ISCUserContainerObject>() { roleData.Group });
			calculator.GenerateUserAndContainerSnapshot(new List<ISCUserContainerObject>() { roleData.Role });

			SameContainerUserAndContainerSnapshotCollection snapshot = UserAndContainerSnapshotAdapter.Instance.LoadByContainerID(roleData.Role.ID);

			Console.WriteLine(roleData.ToString());
			Console.Error.WriteLine("Error: {0}", ProcessProgress.Current.GetDefaultError());
			Console.WriteLine("Output: {0}", ProcessProgress.Current.GetDefaultOutput());

			Assert.IsTrue(snapshot.ContainsKey(roleData.UserInGroup.ID));
			Assert.IsTrue(snapshot.ContainsKey(roleData.UserInOrg.ID));
			Assert.IsTrue(snapshot.ContainsKey(roleData.UserInRole.ID));
			Assert.IsTrue(snapshot.ContainsKey(roleData.UserInConditionRole.ID));
			Assert.IsTrue(snapshot.ContainsKey(roleData.UserInConditionGroup.ID));
		}
		public void IsChildByCodeNameBuiltInFunctionTest()
		{
			SchemaObjectAdapter.Instance.ClearAllData();

			TestRoleData roleData = SCObjectGenerator.PrepareTestRoleWithOrgAndGroup(data => string.Format("IsChild(\"{0}\", \"{1}\")", "CodeName", data.Organization.CodeName));

			SCConditionCalculator calculator = new SCConditionCalculator();

			ProcessProgress.Clear();
			ProcessProgress.Current.RegisterResponser(TestProgressResponser.Instance);

			calculator.GenerateUserAndContainerSnapshot(new List<ISCUserContainerObject>() { roleData.BuiltInFunctionRole });

			SameContainerUserAndContainerSnapshotCollection snapshot = UserAndContainerSnapshotAdapter.Instance.LoadByContainerID(roleData.BuiltInFunctionRole.ID);

			Console.WriteLine(roleData.ToString());
			Console.Error.WriteLine("Error: {0}", ProcessProgress.Current.GetDefaultError());
			Console.WriteLine("Output: {0}", ProcessProgress.Current.GetDefaultOutput());

			Assert.IsTrue(snapshot.ContainsKey(roleData.UserInOrg.ID));
		}
		protected void ProcessCaculating(object sender, MCS.Web.WebControls.PostProgressDoPostedDataEventArgs e)
		{
			SCConditionCalculator calc = new SCConditionCalculator();

			calc.GenerateUserAndContainerSnapshot(new[] { (SCRole)SchemaObjectAdapter.Instance.Load(this.calcProgress.Tag) });

			SCCacheHelper.InvalidateAllCache();

			e.Result.DataChanged = true;
			e.Result.CloseWindow = false;
			e.Result.ProcessLog = ProcessProgress.Current.GetDefaultOutput();
		}