Пример #1
0
        public void CanSerializeListWithEmbeddedWithLinksWithEmbeddedJsonProperty()
        {
            var original = TestListEmbeddedPropertyParentsResource.Default1();

            var          json         = JsonConvert.SerializeObject(original, _settings);
            const string expected     = TestListEmbeddedPropertyParentsResource.SerializedDefault1;
            var          deserialized = JsonConvert.DeserializeObject <TestListEmbeddedPropertyParentsResource>(json, _settings);

            json.ShouldNotBeNullOrWhiteSpace();
            json.ShouldBe(expected, StringCompareShould.IgnoreCase);
            original.ShouldBe(deserialized);
        }
Пример #2
0
        public async Task CanDeserializeListWithEmbeddedWithLinksWithEmbeddedJsonProperty()
        {
            using (var server = LocalWebServer.ListenInBackground(new XUnitMockLogger(_logger)))
            {
                var uri = server.ListeningUri;
                server.WithNextResponse(new MockHttpResponseMessage().WithContent(TestListEmbeddedPropertyParentsResource.SerializedDefault1).WithPrivateCacheHeader().WithDefaultExpiration());

                var result = await CreateBuilder()
                             .WithLink(uri).ResultAsync <TestListEmbeddedPropertyParentsResource>();

                result.ShouldNotBeNull();
                result.ShouldBe(TestListEmbeddedPropertyParentsResource.Default1());
            }
        }