Exemplo n.º 1
0
        public void CanSerializeWithEmbedAsArray()
        {
            var original = TestListEmbeddedArrayParentResource.Default1();

            var json = JsonConvert.SerializeObject(original, _settings);

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

            json.ShouldNotBeNullOrWhiteSpace();
            json.ShouldBe(expected, StringCompareShould.IgnoreCase);
            original.ShouldBe(deserialized);
        }
Exemplo n.º 2
0
        public async Task CanDeserializeWithEmbedAsArray()
        {
            using (var server = LocalWebServer.ListenInBackground(new XUnitMockLogger(_logger)))
            {
                var uri = server.ListeningUri;
                server.WithNextResponse(new MockHttpResponseMessage().WithContent(TestListEmbeddedArrayParentResource.SerializedDefault1).WithPrivateCacheHeader().WithDefaultExpiration());

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

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