예제 #1
0
        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));
        }
예제 #2
0
        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));
        }
예제 #3
0
 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);
 }
예제 #4
0
        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);
        }
예제 #5
0
        public void GenericContentEqualsNullObjectReturnsFalse()
        {
            var content = new ObjectContent(typeof(string), "expected");

            Assert.False(content.Equals(null));
        }