对于“ Visual Studio Team Test”,您似乎将ExpectedException属性应用于该测试的方法。这里的文档样本:使用Visual Studio Team Test进行单元测试的演练[TestMethod][ExpectedException(typeof(ArgumentException), "A userId of null was inappropriately allowed.")]public void NullUserIdInConstructor(){ LogonInfo logonInfo = new LogonInfo(null, "P@ss0word");}