当前位置: 首页>>代码示例>>C#>>正文


C# ObjectManager.DoFixups方法代码示例

本文整理汇总了C#中ObjectManager.DoFixups方法的典型用法代码示例。如果您正苦于以下问题:C# ObjectManager.DoFixups方法的具体用法?C# ObjectManager.DoFixups怎么用?C# ObjectManager.DoFixups使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ObjectManager的用法示例。


在下文中一共展示了ObjectManager.DoFixups方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: runTest

	public Boolean runTest()
	{
		Console.WriteLine(s_strTFPath + " " + s_strTFName + " , for " + s_strClassMethod + " , Source ver : " + s_strDtTmVer);
		int iCountErrors = 0;
		int iCountTestcases = 0;
		String strLoc = "Loc_000oo";
		ObjectManager manager;
		ISurrogateSelector selector = null;
		StreamingContext context = new StreamingContext(StreamingContextStates.All);
		ClsType1 cls1;
		ClsType2 cls2;
		Int32 iValue;
		MemberInfo[] classMembers1;
		MemberInfo[] classMembers2;
		try {
			strLoc = "Loc_734rgt";			
			iCountTestcases++;
			cls1 = new ClsType1();
			cls2 = new ClsType2();
			iValue = 10;
			classMembers1 = FormatterServices.GetSerializableMembers(typeof(ClsType1), context);
			classMembers2 = FormatterServices.GetSerializableMembers(typeof(ClsType2), context);
			manager = new ObjectManager(selector, context);
			manager.RecordFixup(2, classMembers2[0], 3);
			manager.RecordFixup(1, classMembers1[0], 2);
			manager.RegisterObject(cls1, 1);
			manager.RegisterObject(cls2, 2);			
			manager.RegisterObject(iValue, 3);
			manager.DoFixups();
			if(cls1.ClsTp2.I != 10){
				iCountErrors++;
				Console.WriteLine("Err_374sdg! Change of behavioue, unexpected value returned, " + cls1.ClsTp2.I);
			}
			manager.RaiseDeserializationEvent();
			if(cls1.ClsTp2.I != 15){
				iCountErrors++;
				Console.WriteLine("Err_987345sg! Change of behavioue, unexpected value returned, " + cls1.ClsTp2.I);
			}
		} catch (Exception exc_general ) {
			++iCountErrors;
			Console.WriteLine (s_strTFAbbrev + " : Error Err_8888yyy!  strLoc=="+ strLoc +", exc_general==\n"+exc_general.StackTrace);
		}
		if ( iCountErrors == 0 )
		{
			Console.WriteLine( "paSs.   "+s_strTFPath +" "+s_strTFName+" ,iCountTestcases=="+iCountTestcases);
			return true;
		}
		else
		{
			Console.WriteLine("FAiL!   "+s_strTFPath+" "+s_strTFName+" ,iCountErrors=="+iCountErrors+" , BugNums?: "+s_strActiveBugNums );
			return false;
		}
	}
开发者ID:gbarnett,项目名称:shared-source-cli-2.0,代码行数:53,代码来源:co8627raisedeserializationevent.cs

示例2: NestedValueTypes

 public static bool NestedValueTypes() {
 ObjectManager manager = new ObjectManager(null, new StreamingContext(StreamingContextStates.All));
 Val1 val1 = new Val1(2);
 manager.RegisterObject(val1, 1);
 manager.RegisterObject(val1.val, 2, null, 1, Val1.valFieldInfo);
 manager.RegisterObject(val1.val.Foo, 3, null, 2, Val2.fooFieldInfo);
 manager.RegisterObject(val1.val.Bar, 4, null, 2, Val2.barFieldInfo);
 manager.RecordFixup(4, Val3.aFieldInfo, 5);
 int newValue = 42;
 A a = new A(newValue);
 manager.RegisterObject(a, 5);
 manager.DoFixups();
 Val1 valPost = (Val1)manager.GetObject(1);
 return (valPost.Int32Value==newValue);
 }
开发者ID:gbarnett,项目名称:shared-source-cli-2.0,代码行数:15,代码来源:covaluetypefixup.cs

示例3: runTest

	public bool runTest()
	{
		Console.WriteLine(s_strTFPath + " " + s_strTFName + " , for " + s_strClassMethod + " , Source ver : " + s_strDtTmVer);
		int iCountErrors = 0;
		int iCountTestcases = 0;
		String strLoc = "Loc_000oo";
		ObjectManager objmgr1 = null;
		StreamingContext sc1 = new StreamingContext(StreamingContextStates.All);
		ObjectIDGenerator objid1 = null;
		Int64 iRootID;
		Int64 iChildID;
		bool fFirstTime;
		String[] strArr;
		String strToBeFixed;
		TestArrayFixup[] arrTst1;
		TestArrayFixup tst1;
		Int32[] indices;
		String[,] multiArr;
		String anotherString;
		Int64 anotherStringId;
		try {
			do
			{
				strLoc = "Loc_9457and";
				strArr = new String[1];
				strToBeFixed = "Hello World";
				indices = new Int32[1];
				indices[0] = 0;
				objid1 = new ObjectIDGenerator();
				iRootID = objid1.GetId(strArr, out fFirstTime);
				iChildID = objid1.GetId(strToBeFixed, out fFirstTime);
				objmgr1 = new ObjectManager(null, sc1);
				objmgr1.RecordArrayElementFixup(iRootID, indices, iChildID);
				objmgr1.RegisterObject(strArr, iRootID);
				objmgr1.RegisterObject(strToBeFixed, iChildID);
				iCountTestcases++;
				if(!strArr[0].Equals(strToBeFixed))
				{
					iCountErrors++;
					Console.WriteLine("Err_0452fsd! Expected value not returned, " + strArr[0] + ", expected, " + strToBeFixed);
				}
				objmgr1.DoFixups();
				strLoc = "Loc_017ged";
				iCountTestcases++;
				if(!strArr[0].Equals(strToBeFixed))
				{
					iCountErrors++;
					Console.WriteLine("Err_90453vdf! Expected value not returned, " + strArr[0] + ", expected, " + strToBeFixed);
				}
				multiArr = new String[5, 10];
				indices = new Int32[2];
				indices[0] = 1;
				indices[1] = 5;
				objid1 = new ObjectIDGenerator();
				iRootID = objid1.GetId(multiArr, out fFirstTime);
				strToBeFixed = "Hello World";
				iChildID = objid1.GetId(strToBeFixed, out fFirstTime);
				objmgr1 = new ObjectManager(null, sc1);
				objmgr1.RecordArrayElementFixup(iRootID, indices, iChildID);
				objmgr1.RegisterObject(multiArr, iRootID);
				objmgr1.RegisterObject(strToBeFixed, iChildID);
				iCountTestcases++;
				if(!multiArr[1, 5].Equals(strToBeFixed)){
					iCountErrors++;
					Console.WriteLine("Err_79435sdg_! Expected value not returned, " + multiArr[1,5] + ", expected, " + strToBeFixed);
				}
				strLoc = "Loc_1294cd";
				arrTst1 = new TestArrayFixup[10];
				tst1 = new TestArrayFixup();
				indices = new Int32[1];
				indices[0] = 5;
				objid1 = new ObjectIDGenerator();
				iRootID = objid1.GetId(arrTst1, out fFirstTime);
				iChildID = objid1.GetId(tst1, out fFirstTime);
				objmgr1 = new ObjectManager(null, sc1);
				objmgr1.RecordArrayElementFixup(iRootID, indices, iChildID);
				objmgr1.RegisterObject(arrTst1, iRootID);
				objmgr1.RegisterObject(tst1, iChildID);
				iCountTestcases++;
				if(arrTst1[5].iValue != tst1.iValue)
				{
					iCountErrors++;
					Console.WriteLine("Err_112sx! Expected value not returned, " + arrTst1[5].iValue + ", expected, " + tst1.iValue);
				}
				objmgr1.DoFixups();
				strLoc = "Loc_017ged";
				iCountTestcases++;
				if(arrTst1[5].iValue != tst1.iValue)
				{
					iCountErrors++;
					Console.WriteLine("Err_2048cd! Expected value not returned, " + arrTst1[5].iValue + ", expected, " + tst1.iValue);
				}
				strLoc = "Loc_83476tsg";
				iCountTestcases++;
				strArr = new String[1];
				strToBeFixed = "Hello World";
				indices = new Int32[2];
				indices[0] = 0;
				indices[1] = 0;
				objid1 = new ObjectIDGenerator();
//.........这里部分代码省略.........
开发者ID:gbarnett,项目名称:shared-source-cli-2.0,代码行数:101,代码来源:co3891recordarrayelementfixup_lial.cs

示例4: runTest

	public bool runTest()
	{
		Console.WriteLine(s_strTFPath + " " + s_strTFName + " , for " + s_strClassMethod + " , Source ver : " + s_strDtTmVer);
		int iCountErrors = 0;
		int iCountTestcases = 0;
		String strLoc = "Loc_000oo";
		ObjectManager objmgr1 = null;
		ISurrogateSelector isur = null;
		StreamingContext sc1 = new StreamingContext(StreamingContextStates.All);
		ObjectIDGenerator objid1 = null;
		TestFixup tstfxp1;
		Int64 iRootID;
		Int64 iChildID;
		String strValue;
		bool fFirstTime;
		MemberInfo[] members = null;
		TestReference tst1;
		ThisImplementsIObjectReference tst2;
		try {
			do
			{
				strLoc="Loc_174cds";
				tstfxp1 = new TestFixup();
				objid1 = new ObjectIDGenerator();
				iRootID = objid1.GetId(tstfxp1, out fFirstTime);
				strValue = "Hello World";
				iChildID = objid1.GetId(strValue, out fFirstTime);
				members = FormatterServices.GetSerializableMembers(tstfxp1.GetType());
				objmgr1 = new ObjectManager(isur, sc1);
				objmgr1.RecordFixup(iRootID, members[0], iChildID);
				objmgr1.RegisterObject(tstfxp1, iRootID);
				objmgr1.RegisterObject(strValue, iChildID);
				iCountTestcases++;
				if(!tstfxp1.strFixupValue.Equals(strValue))
				{
					iCountErrors++;
					Console.WriteLine("Err_753cd! Expected value not returned, " + tstfxp1.strFixupValue + ", expected, " + strValue);
				}
				objmgr1.DoFixups();
				iCountTestcases++;
				if(!tstfxp1.strFixupValue.Equals(strValue))
				{
					iCountErrors++;
					Console.WriteLine("Err_90342ddvs! Expected value not returned, " + tstfxp1.strFixupValue + ", expected, " + strValue);
				}
				strLoc="Loc_5720xs";
				tst1 = new TestReference();
				tst2 = new ThisImplementsIObjectReference();
				objid1 = new ObjectIDGenerator();
				iRootID = objid1.GetId(tst1, out fFirstTime);
				iChildID = objid1.GetId(tst2, out fFirstTime);
				members = FormatterServices.GetSerializableMembers(typeof(TestReference));
				Console.WriteLine("<<" + members[0].Name + ">>");
				objmgr1 = new ObjectManager(isur, sc1);
				objmgr1.RecordFixup(iRootID, members[0], iChildID);
				objmgr1.RegisterObject(tst1, iRootID);
				objmgr1.RegisterObject(tst2, iChildID);
				try{
					iCountTestcases++;
					objmgr1.DoFixups();
					iCountErrors++;
					Console.WriteLine("Err_753fvdf! exception not thrown!!");
				}catch(SerializationException){
				}catch(Exception ex){
					iCountErrors++;
					Console.WriteLine("Err_04523cd! Unexpected exception, " + ex.ToString());
				}
			} while (false);
			} catch (Exception exc_general ) {
			++iCountErrors;
			Console.WriteLine (s_strTFAbbrev + " : Error Err_8888yyy!  strLoc=="+ strLoc +", exc_general==\n"+exc_general.StackTrace);
		}
		if ( iCountErrors == 0 )
		{
			Console.WriteLine( "paSs.   "+s_strTFPath +" "+s_strTFName+" ,iCountTestcases=="+iCountTestcases);
			return true;
		}
		else
		{
			Console.WriteLine("FAiL!   "+s_strTFPath+" "+s_strTFName+" ,iCountErrors=="+iCountErrors+" , BugNums?: "+s_strActiveBugNums );
			return false;
		}
	}
开发者ID:gbarnett,项目名称:shared-source-cli-2.0,代码行数:83,代码来源:co3892dofixups.cs

示例5: runTest

	public bool runTest()
	{
		Console.WriteLine(s_strTFPath + " " + s_strTFName + " , for " + s_strClassMethod + " , Source ver : " + s_strDtTmVer);
		int iCountErrors = 0;
		int iCountTestcases = 0;
		String strLoc = "Loc_000oo";
		ObjectManager objmgr1 = null;
		ISurrogateSelector isur = null;
		StreamingContext sc1 = new StreamingContext(StreamingContextStates.All);
		ObjectIDGenerator objid1 = null;
		TestFixup tstfxp1;
		Int64 iRootID;
		Int64 iChildID;
		Int32 iValue;
		bool fFirstTime;
		MemberInfo[] members = null;
		SerializationInfo serInfo1;
		try {
			do
			{
				strLoc = "Loc_8345vdfv";
				tstfxp1 = new TestFixup();
				iValue = 10;
				objid1 = new ObjectIDGenerator();
				iRootID = objid1.GetId(tstfxp1, out fFirstTime);
				iChildID = objid1.GetId(iValue, out fFirstTime);
				members = FormatterServices.GetSerializableMembers(tstfxp1.GetType());
				objmgr1 = new ObjectManager(isur, sc1);
				objmgr1.RecordDelayedFixup(iRootID, "iFixupValue", iChildID);
				serInfo1 = new SerializationInfo(typeof(TestFixup), new FormatterConverter());
				objmgr1.RegisterObject(tstfxp1, iRootID, serInfo1);
				iCountTestcases++;
				if(objmgr1.GetObject(iRootID)==null)
				{
					iCountErrors++;
					Console.WriteLine("Err_0943fd! Null returned");
				}
				objmgr1.RegisterObject(iValue, iChildID);
				objmgr1.DoFixups();
				strLoc = "Loc_017ged";
				iCountTestcases++;
				if(tstfxp1.iFixupValue != iValue)
				{
					iCountErrors++;
					Console.WriteLine("Err_753cd! Expected value not returned, " + tstfxp1.iFixupValue.ToString() + ", expected, " + iValue.ToString());
				}
				strLoc = "Loc_0358vdf";
				try
				{
					iCountTestcases++;
					objmgr1.RegisterObject(null, iRootID, serInfo1);
					iCountErrors++;
					Console.WriteLine("Err_034cd! exception not thrown");
				}
				catch(ArgumentNullException){}
				catch(Exception ex)
				{
					iCountErrors++;
					Console.WriteLine("Err_03472fd! Unexpected exception, " + ex.ToString());
				}
				try
				{
					iCountTestcases++;
					objmgr1.RegisterObject(tstfxp1, -5, serInfo1);
					iCountErrors++;
					Console.WriteLine("Err_037csd! exception not thrown");
				}
				catch(ArgumentOutOfRangeException){}
				catch(Exception ex)
				{
					iCountErrors++;
					Console.WriteLine("Err_710ca! Unexpected exception, " + ex.ToString());
				}
				try
				{
					iCountTestcases++;
					objmgr1.RegisterObject(tstfxp1, 5, null);
					Console.WriteLine("Loc_048cs! exception not thrown");
				}
				catch(Exception ex)
				{
					iCountErrors++;
					Console.WriteLine("Err_079cd! Unexpected exception, " + ex.ToString());
				}
			} while (false);
			} catch (Exception exc_general ) {
			++iCountErrors;
			Console.WriteLine (s_strTFAbbrev + " : Error Err_8888yyy!  strLoc=="+ strLoc +", exc_general==\n"+exc_general.ToString());
		}
		if ( iCountErrors == 0 )
		{
			Console.WriteLine( "paSs.   "+s_strTFPath +" "+s_strTFName+" ,iCountTestcases=="+iCountTestcases);
			return true;
		}
		else
		{
			Console.WriteLine("FAiL!   "+s_strTFPath+" "+s_strTFName+" ,iCountErrors=="+iCountErrors+" , BugNums?: "+s_strActiveBugNums );
			return false;
		}
	}
开发者ID:ArildF,项目名称:masters,代码行数:100,代码来源:co3894registerobject_oiser.cs

示例6: runTest

	public bool runTest()
	{
		Console.WriteLine(s_strTFPath + " " + s_strTFName + " , for " + s_strClassMethod + " , Source ver : " + s_strDtTmVer);
		int iCountErrors = 0;
		int iCountTestcases = 0;
		String strLoc = "Loc_000oo";
		ObjectManager objmgr1 = null;
		ISurrogateSelector isur = null;
		StreamingContext sc1 = new StreamingContext(StreamingContextStates.All);
		ObjectIDGenerator objid1 = null;
		TestFixup tstfxp1;
		Int64 iRootID;
		Int64 iChildID;
		String strValue;
		bool fFirstTime;
		MemberInfo[] members = null;
		Test1 tst1;
		A a1;
		Int32 iOurMan;
		Boolean fChildFound;
		Test2 tst2;
		Test3 tst3;
		B b1;
		try {
			do
			{
				tstfxp1 = new TestFixup();
				objid1 = new ObjectIDGenerator();
				iRootID = objid1.GetId(tstfxp1, out fFirstTime);
				strValue = "Hello World";
				iChildID = objid1.GetId(strValue, out fFirstTime);
				members = FormatterServices.GetSerializableMembers(tstfxp1.GetType());
				objmgr1 = new ObjectManager(isur, sc1);
				objmgr1.RecordFixup(iRootID, members[0], iChildID);
				objmgr1.RegisterObject(tstfxp1, iRootID);
				objmgr1.RegisterObject(strValue, iChildID);
				iCountTestcases++;
				if(!tstfxp1.strFixupValue.Equals(strValue))
				{
					iCountErrors++;
					Console.WriteLine("Err_753cd! Expected value not returned, " + tstfxp1.strFixupValue + ", expected, " + strValue);
				}
				objmgr1.DoFixups();
				iCountTestcases++;
				if(!tstfxp1.strFixupValue.Equals(strValue))
				{
					iCountErrors++;
					Console.WriteLine("Err_90342ddvs! Expected value not returned, " + tstfxp1.strFixupValue + ", expected, " + strValue);
				}
				tst1 = new Test1();
				a1 = new A();
				objid1 = new ObjectIDGenerator();
				iRootID = objid1.GetId(tst1, out fFirstTime);
				iChildID = objid1.GetId(a1, out fFirstTime);
				members = FormatterServices.GetSerializableMembers(typeof(Test1));
				iOurMan = -1;
				fChildFound=false;
				for(int i=0; i<members.Length;i++){
					if(members[i].Name.Equals("a")){
						fChildFound=true;
						iOurMan=i;
						break;
					}
				}
				if(!fChildFound)
				throw new Exception("Loc_342ds! didn't find the member");
				objmgr1 = new ObjectManager(isur, sc1);
				objmgr1.RecordFixup(iRootID, members[iOurMan], iChildID);
				try{
					iCountTestcases++;
					objmgr1.RegisterObject(a1, iChildID);
					objmgr1.RegisterObject(tst1, iRootID);
					objmgr1.DoFixups();
					Console.WriteLine("Loc_0283! exception not thrown");
					}catch(Exception ex){
					iCountErrors++;
					Console.WriteLine("Err_04523cd! Unexpected exception, " + ex.ToString());
				}
				tst1 = new Test1();
				objid1 = new ObjectIDGenerator();
				iRootID = objid1.GetId(tst1, out fFirstTime);
				a1 = new A();
				iChildID = objid1.GetId(a1, out fFirstTime);
				members = FormatterServices.GetSerializableMembers(typeof(Test1));
				iOurMan = -1;
				fChildFound=false;
				for(int i=0; i<members.Length;i++){
					if(members[i].Name.Equals("a")){
						fChildFound=true;
						iOurMan=i;
						break;
					}
				}
				if(!fChildFound)
				throw new Exception("Loc_342ds! didn't find the member");
				objmgr1 = new ObjectManager(isur, sc1);
				objmgr1.RecordFixup(iRootID, members[iOurMan], iChildID);
				try{
					iCountTestcases++;
					objmgr1.DoFixups();
//.........这里部分代码省略.........
开发者ID:ArildF,项目名称:masters,代码行数:101,代码来源:co3861recordfixup.cs

示例7: runTest

	public bool runTest()
	{
		Console.WriteLine(s_strTFPath + "\\" + s_strTFName + " , for " + s_strClassMethod + " , Source ver " + s_strDtTmVer);
		String strLoc = "Loc_000oo";
		String strValue = String.Empty;
		int iCountErrors = 0;
		int iCountTestcases = 0;
		ObjectManager objmgr1 = null;
		ISurrogateSelector isur = null;
		StreamingContext sc1 = new StreamingContext(StreamingContextStates.All);
		ObjectIDGenerator objid1 = null;
		TestFixup tstfxp1;
		Int64 iRootID;
		Int64 iChildID;
		bool fFirstTime;
		MemberInfo[] members = null;
		try
		{
			strLoc = "Loc_9347sg";
			iCountTestcases++;
			try{
				ConstructOM(); 
				iCountErrors++;
				Console.WriteLine("Err_7349sg! No exception thrown, ");
			}catch(SecurityException){
			}catch(Exception ex){
				iCountErrors++;
				Console.WriteLine("Err_348tdg! Wrong exception thrown, " + ex.GetType().Name);
			}
			strLoc = "Loc_3946tsg";
			iCountTestcases++;
			tstfxp1 = new TestFixup();
			objid1 = new ObjectIDGenerator();
			iRootID = objid1.GetId(tstfxp1, out fFirstTime);
			strValue = "Hello World";
			iChildID = objid1.GetId(strValue, out fFirstTime);
			members = FormatterServices.GetSerializableMembers(tstfxp1.GetType());
			objmgr1 = new ObjectManager(isur, sc1);
			objmgr1.RecordFixup(iRootID, members[0], iChildID);
			objmgr1.RegisterObject(tstfxp1, iRootID);
			objmgr1.RegisterObject(strValue, iChildID);
			iCountTestcases++;
			if(!tstfxp1.strFixupValue.Equals(strValue))
			{
				iCountErrors++;
				Console.WriteLine("Err_753cd! Expected value not returned, " + tstfxp1.strFixupValue + ", expected, " + strValue);
			}
			objmgr1.DoFixups();
			iCountTestcases++;
			if(!tstfxp1.strFixupValue.Equals(strValue))
			{
				iCountErrors++;
				Console.WriteLine("Err_90342ddvs! Expected value not returned, " + tstfxp1.strFixupValue + ", expected, " + strValue);
			}
		} catch (Exception exc_general ) {
			++iCountErrors;
			Console.WriteLine (s_strTFAbbrev + " : Error Err_8888yyy!  strLoc=="+ strLoc +", exc_general=="+exc_general.ToString());
		}
		if ( iCountErrors == 0 )
		{
			Console.WriteLine( "paSs. "+s_strTFName+" ,iCountTestcases=="+iCountTestcases.ToString());
			return true;
		}
		else
		{
			Console.WriteLine("FAiL! "+s_strTFName+" ,inCountErrors=="+iCountErrors.ToString()+" , BugNums?: "+s_strActiveBugNums );
			return false;
		}
	}
开发者ID:ArildF,项目名称:masters,代码行数:69,代码来源:co8650objectmanager.cs

示例8: runTest

	public Boolean runTest()
	{
		Console.WriteLine(s_strTFPath + " " + s_strTFName + " , for " + s_strClassMethod + " , Source ver : " + s_strDtTmVer);
		int iCountErrors = 0;
		int iCountTestcases = 0;
		String strLoc = "Loc_000oo";
		ObjectManager manager;
		ISurrogateSelector selector = null;
		StreamingContext context = new StreamingContext(StreamingContextStates.All);
		ClsType cls1;
		ValType val1;
		Int32 iValue;
		MemberInfo[] valueMembers;
		MemberInfo[] classMembers;
		MemberInfo[] classMembers1;
		ClsType1 cls2;
		ClsType2 cls3;
		ClsType3 cls4;
		ValType1 val2;
		SerializationInfo info;
		try {
			strLoc = "Loc_97356tsg";			
			iCountTestcases++;
			cls1 = new ClsType();
			val1 = new ValType();
			iValue = 10;
			classMembers = FormatterServices.GetSerializableMembers(typeof(ClsType), context);
			valueMembers = FormatterServices.GetSerializableMembers(typeof(ValType), context);
			manager = new ObjectManager(selector, context);
			manager.RecordFixup(2, valueMembers[0], 3);
			manager.RecordFixup(1, classMembers[0], 2);
			manager.RegisterObject(cls1, 1);
			manager.RegisterObject(val1, 2);			
			manager.RegisterObject(iValue, 3);
			if(cls1.ValueType.I != 0){
				iCountErrors++;
				Console.WriteLine("Err_853rwtg! Change of behavioue, unexpected value returned, " + cls1.ValueType.I);
			}
			strLoc = "Loc_7934sgd";			
			iCountTestcases++;
			cls1 = new ClsType();
			val1 = new ValType();
			iValue = 10;
			classMembers = FormatterServices.GetSerializableMembers(typeof(ClsType), context);
			valueMembers = FormatterServices.GetSerializableMembers(typeof(ValType), context);
			manager = new ObjectManager(selector, context);
			manager.RecordFixup(2, valueMembers[0], 3);
			manager.RecordFixup(1, classMembers[0], 2);
			manager.RegisterObject(cls1, 1);
			manager.RegisterObject(val1, 2, null, 1, classMembers[0]);
			manager.RegisterObject(iValue, 3);
			if(cls1.ValueType.I != 10){
				iCountErrors++;
				Console.WriteLine("Err_23450sdg! Unexpected value returned, " + cls1.ValueType.I);
			}
			strLoc = "Loc_734rgt";			
			iCountTestcases++;
			cls2 = new ClsType1();
			cls3 = new ClsType2();
			iValue = 10;
			classMembers = FormatterServices.GetSerializableMembers(typeof(ClsType1), context);
			classMembers1 = FormatterServices.GetSerializableMembers(typeof(ClsType2), context);
			manager = new ObjectManager(selector, context);
			manager.RecordFixup(2, classMembers1[0], 3);
			manager.RecordFixup(1, classMembers[0], 2);
			manager.RegisterObject(cls2, 1);
			manager.RegisterObject(cls3, 2);			
			manager.RegisterObject(iValue, 3);
			if(cls2.Cls2.I != 10){
				iCountErrors++;
				Console.WriteLine("Err_987345sg! Change of behavioue, unexpected value returned, " + cls2.Cls2.I);
			}
			strLoc = "Loc_9743sg";			
			iCountTestcases++;
			cls4 = new ClsType3();
			val2 = new ValType1();
			iValue = 10;
			classMembers = FormatterServices.GetSerializableMembers(typeof(ClsType3), context);
			manager = new ObjectManager(selector, context);
			manager.RecordDelayedFixup(2, "SerializationTest", 3);
			manager.RecordFixup(1, classMembers[0], 2);
			manager.RegisterObject(cls4, 1);
			info = new SerializationInfo(typeof(ValType1), new FormatterConverter());
			manager.RegisterObject(val2, 2, info, 1, classMembers[0]);
			manager.RegisterObject(iValue, 3);
			try{
				manager.DoFixups();
			}catch(ArgumentException){
			}catch(Exception ex){
				iCountErrors++;
				Console.WriteLine("Err_3497tsdg! Wrong exception thrown, " + ex.GetType().Name);
			}
			strLoc = "Loc_8932745rsdf";			
			iCountTestcases++;
			cls1 = new ClsType();
			val1 = new ValType();
			iValue = 10;
			classMembers = FormatterServices.GetSerializableMembers(typeof(ClsType), context);
			valueMembers = FormatterServices.GetSerializableMembers(typeof(ValType), context);
			manager = new ObjectManager(selector, context);
//.........这里部分代码省略.........
开发者ID:gbarnett,项目名称:shared-source-cli-2.0,代码行数:101,代码来源:co8628registerobject_oisim.cs


注:本文中的ObjectManager.DoFixups方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。