다음을 통해 공유


Assert.AreNotSame 메서드 (Object, Object, String)

지정한 두 개체 변수가 서로 다른 개체를 참조하는지 확인합니다.같은 개체를 참조하면 어설션이 실패합니다.어설션이 실패할 경우 메시지를 표시합니다.

네임스페이스:  Microsoft.VisualStudio.TestTools.UnitTesting
어셈블리:  Microsoft.VisualStudio.QualityTools.UnitTestFramework(Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll)

구문

‘선언
Public Shared Sub AreNotSame ( _
    notExpected As Object, _
    actual As Object, _
    message As String _
)
public static void AreNotSame(
    Object notExpected,
    Object actual,
    string message
)
public:
static void AreNotSame(
    Object^ notExpected, 
    Object^ actual, 
    String^ message
)
static member AreNotSame : 
        notExpected:Object * 
        actual:Object * 
        message:string -> unit 
public static function AreNotSame(
    notExpected : Object, 
    actual : Object, 
    message : String
)

매개 변수

  • notExpected
    형식: System.Object
    비교할 첫 번째 개체입니다.단위 테스트에서 actual과 일치하지 않을 것으로 예상하는 개체입니다.
  • actual
    형식: System.Object
    비교할 두 번째 개체입니다.단위 테스트에서 생성한 개체입니다.
  • message
    형식: System.String
    어설션이 실패할 경우 표시되는 메시지입니다.이 메시지는 단위 테스트 결과에 표시됩니다.

예외

예외 조건
AssertFailedException

notExpected가 actual과 동일한 개체를 참조하는 경우

.NET Framework 보안

  • 직접 실행 호출자의 경우 완전히 신뢰합니다. 이 멤버는 부분적으로 신뢰할 수 있는 코드에서 사용할 수 없습니다. 자세한 내용은 부분 신뢰 코드에서 라이브러리 사용을 참조하십시오.

참고 항목

참조

Assert 클래스

AreNotSame 오버로드

Microsoft.VisualStudio.TestTools.UnitTesting 네임스페이스

기타 리소스

Assert 클래스 사용