public void GenericContentVerifyContentMatchesAgainstDefaultSystemStringContent(object expected) { var content = new ObjectContent(expected.GetType(), expected); var stringContent = new SystemStringContent(JsonConvert.SerializeObject(expected), Encoding.UTF8, "application/json"); Assert.True(content.Equals(stringContent)); }
public void GenericContentVerifyContentMatchedContent(object expected) { var content1 = new ObjectContent(expected.GetType(), expected); var content2 = new ObjectContent(expected.GetType(), expected); Assert.True(content1 == content2); Assert.False(content1 != content2); Assert.True(content1.Equals(content2)); }
private void AssertContent <T>(T expected, ObjectContent <T> content) { Assert.Equal(expected.ToString(), content.ToString()); Assert.Equal(expected.GetHashCode(), content.GetHashCode()); Assert.True(content.Equals(expected)); Assert.True(expected == content); Assert.False(expected != content); Assert.True(content == expected); Assert.False(content != expected); }
public void GenericContentVerifyObjectMatchedContent(object expected) { var content = new ObjectContent(expected.GetType(), expected); Assert.Equal(expected.ToString(), content.ToString()); Assert.Equal(expected.GetHashCode(), content.GetHashCode()); Assert.True(content.Equals(expected)); Assert.True(expected == content); Assert.False(expected != content); Assert.True(content == expected); Assert.False(content != expected); }
public void GenericContentEqualsNullObjectReturnsFalse() { var content = new ObjectContent(typeof(string), "expected"); Assert.False(content.Equals(null)); }