Assert.AreSame C# (CSharp) Méthode

AreSame() public static méthode

public static AreSame ( object x, object y, string msg ) : void
x object
y object
msg string
Résultat void
	public static void AreSame (object x, object y, string msg)
	{
		if (!object.ReferenceEquals (x, y))
			throw new Exception (msg);
	}
}

Usage Example

        public void SendDirectMessageResponse()
        {
            IProtocolMessage message = new TestDirectedMessage {
                Age      = 15,
                Name     = "Andrew",
                Location = new Uri("http://hostb/pathB"),
            };

            OutgoingWebResponse response = this.channel.PrepareResponse(message);

            Assert.AreSame(message, response.OriginalMessage);
            Assert.AreEqual(HttpStatusCode.OK, response.Status);
            Assert.AreEqual(0, response.Headers.Count);

            NameValueCollection body = HttpUtility.ParseQueryString(response.Body);

            Assert.AreEqual("15", body["age"]);
            Assert.AreEqual("Andrew", body["Name"]);
            Assert.AreEqual("http://hostb/pathB", body["Location"]);
        }
All Usage Examples Of Assert::AreSame