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


C# ObjectManager.RecordFixup方法代码示例

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


在下文中一共展示了ObjectManager.RecordFixup方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: Bug

 private static bool Bug() {
 ObjectManager objmgr1;
 StreamingContext sc1;
 ObjectIDGenerator objid1;
 TestFixup tstfxp1;
 Int64 iRootID;
 Int64 iChildID;
 String strValue;
 MemberInfo[] members;
 Boolean fFirstTime;
 sc1 = new StreamingContext(StreamingContextStates.All);
 tstfxp1 = new TestFixup();
 strValue = "Hello World";
 objid1 = new ObjectIDGenerator();
 iRootID = objid1.GetId(tstfxp1, out fFirstTime);
 iChildID = objid1.GetId(strValue, out fFirstTime);
 members = FormatterServices.GetSerializableMembers(tstfxp1.GetType()); 
 objmgr1 = new ObjectManager(null, sc1);
 objmgr1.RecordFixup(iRootID, members[0], iChildID);
 try {
 objmgr1.RegisterObject(strValue, iChildID);	
 return true;
 } catch(Exception ex){
 Console.WriteLine("Bug:Exception thrown, " + ex);
 return false;
 }
 }
开发者ID:ArildF,项目名称:masters,代码行数:27,代码来源:coserializationregression.cs

示例3: 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

示例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;
		StreamingContext sc1 = new StreamingContext(StreamingContextStates.All);
		ObjectIDGenerator objid1 = null;
		TestFixup tstfxp1;
		Int64 iRootID;
		Int64 iChildID;
		String strValue;
		bool fFirstTime;
		MemberInfo[] members = null;
		try {
			do
			{
				strLoc="Loc_174cds";
				tstfxp1 = new TestFixup();
				objid1 = new ObjectIDGenerator();
				iRootID = objid1.GetId(tstfxp1, out fFirstTime);
				strValue = "Hello Universe";
				iChildID = objid1.GetId(strValue, out fFirstTime);
				members = FormatterServices.GetSerializableMembers(tstfxp1.GetType());
				objmgr1 = new ObjectManager(null, sc1);
				iCountTestcases++;
				if(objmgr1.GetObject(iRootID)!=null)
				{
					iCountErrors++;
					Console.WriteLine("Err_753cd! Expected value not returned, " + objmgr1.GetObject(iRootID));
				}
				objmgr1.RecordFixup(iRootID, members[0], iChildID);
				iCountTestcases++;
				if(objmgr1.GetObject(iRootID)!=null)
				{
					iCountErrors++;
					Console.WriteLine("Err_048fd! Expected value not returned, " + objmgr1.GetObject(iRootID));
				}
				objmgr1.RegisterObject(tstfxp1, iRootID);
				iCountTestcases++;
				if(objmgr1.GetObject(iRootID)==null)
				{
					iCountErrors++;
					Console.WriteLine("Err_0943fd! Null returned");
				}
				iCountTestcases++;
				if(!((TestFixup)(objmgr1.GetObject(iRootID))).strFixupValue.Equals("Hello World"))
				{
					iCountErrors++;
					Console.WriteLine("Err_047fe! wrong value returned returned, " + ((TestFixup)(objmgr1.GetObject(iRootID))).strFixupValue);
				}
				objmgr1.RegisterObject(strValue, iChildID);
				iCountTestcases++;
				if(objmgr1.GetObject(iChildID)==null)
				{
					iCountErrors++;
					Console.WriteLine("Err_90853vdf! Null returned");
				}
				iCountTestcases++;
				if(!objmgr1.GetObject(iChildID).Equals("Hello Universe"))
				{
					iCountErrors++;
					Console.WriteLine("Err_1084cs! wrong value returned returned, " + objmgr1.GetObject(iChildID));
				}
				try{
					iCountTestcases++;
					objmgr1.GetObject(-5);
					iCountErrors++;
					Console.WriteLine("Err_04872d! Exception not thrown");
					}catch(ArgumentOutOfRangeException){
					}catch(Exception ex){
					iCountErrors++;
					Console.WriteLine("Err_1083xs! Wrong Exception thrown, " + ex);
				}
			} 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:ArildF,项目名称:masters,代码行数:91,代码来源:co3893getobject_lng.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 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";
		IFormatter formatter;
		SurrogateSelector selector;
		MySerializationSurrogate surrogate;
		StreamingContext context = new StreamingContext(StreamingContextStates.All);
		MemoryStream stream;
		Int32 iValue;
		A a;
		ObjectManager manager;
		ObjectIDGenerator generator;
		Int64 rootId;
		Int64 childId;
		Boolean firstTime;
		MemberInfo[] members;
		try {
			strLoc = "Loc_29457sdg";
			iCountTestcases++;
			selector = new SurrogateSelector();
			surrogate = new MySerializationSurrogate();
			selector.AddSurrogate(typeof(A), context, surrogate);
			formatter = new BinaryFormatter();
			formatter.SurrogateSelector = selector;
			stream = new MemoryStream();
			a = new A();
			a.I = 10;
			formatter.Serialize(stream, a);
			stream.Position = 0;
			A a1 = (A)formatter.Deserialize(stream);
			if(a1.I != 30){
				iCountErrors++;
				Console.WriteLine("Err_753ffd! Unexpected value returned, Value: <{0}>", a1.I);
			}
			strLoc = "Loc_8394tfsg";
			iCountTestcases++;
			generator = new ObjectIDGenerator();
			a = new A();
			iValue = 500;
			rootId = generator.GetId(a, out firstTime);
			childId = generator.GetId(iValue, out firstTime);
			selector = new SurrogateSelector();
			surrogate = new MySerializationSurrogate();
			selector.AddSurrogate(typeof(A), context, surrogate);
			manager = new ObjectManager(selector, context);
			members = FormatterServices.GetSerializableMembers(typeof(A));
			manager.RecordDelayedFixup(rootId, "Int32Twist", childId);
			try{
				SerializationInfo serInfo1 = new SerializationInfo(typeof(A), new FormatterConverter());
				manager.RegisterObject(a, rootId, serInfo1);
				manager.RegisterObject(iValue, childId);
				Console.WriteLine(a.I);
			}catch(Exception ex){
				iCountErrors++;
				Console.WriteLine(ex);
			}
			strLoc = "Loc_87sgsfd";
			iCountTestcases++;
			generator = new ObjectIDGenerator();
			a = new A();
			iValue = 500;
			rootId = generator.GetId(a, out firstTime);
			childId = generator.GetId(iValue, out firstTime);
			manager = new ObjectManager(null, context);
			members = FormatterServices.GetSerializableMembers(typeof(A));
			manager.RecordFixup(rootId, members[0], childId);
			manager.RegisterObject(a, rootId);
			manager.RegisterObject(iValue, childId);
			if(a.I != 500){
				iCountErrors++;
				Console.WriteLine("Err_93745sg! Unexpected value returned, Value: <{0}>", a1.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:ArildF,项目名称:masters,代码行数:90,代码来源:co8626ctor_is.cs

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