NUnit.Framework.Assert.IsInstanceOfType()已过时
我正在阅读专业企业.NET的书,我注意到这个警告在一些示例程序:
'NUnit.Framework.Assert.IsInstanceOfType(System.Type, object)' is obsolete 现在我可能已经回答了我自己的问题,但是,解决这个警告是简单的用Assert.IsInstanceOf()replaceAssert.IsInstanceOfType()? 比如这个:
 Assert.IsInstanceOfType(typeof(ClassName), variableName); 
会成为:
 Assert.IsInstanceOf(typeof(ClassName), variableName); 
	
 从NUnit文档 IsInstanceOf方法是一个通用的方法,所以你可以使用这个: 
 Assert.IsInstanceOf<ClassName>(variableName); 
为了完整性:如果您使用约束模型 :
 Assert.That(variableName, Is.InstanceOf<ClassName>()); 
 或者你的testing类inheritanceAssertionHelper : 
 Expect(variableName, InstanceOf<ClassName>());