コード例 #1
0
        public void ThrowsRightException()
        {
            var person = new PersonWithNoId();
            var target = new ResourceSerializer(person, DefaultResource,
                                                GetUri(id: "123"), DefaultPathBuilder, null, null, null);

            Assert.Throws <JsonApiException>(() =>
            {
                target.Serialize();
            });
        }
コード例 #2
0
        public void ThrowsRightException()
        {
            var person = new PersonWithNoId();
            var target = new ResourceSerializer(urlBuilder: new DefaultUrlPathBuilder("/api"));

            var resourceResult = new ResourceResult
            {
                Resource = new CompanyResource(),
                Result   = person
            };

            Assert.Throws <JsonApiException>(() =>
            {
                target.Serialize(resourceResult, GetUri(id: "123").ToString());
            });
        }