コード例 #1
0
        public async Task SyncNextUrlShouldSerializeIntoSyncResultCorrectly()
        {
            //Arrange
            _handler.Response = GetResponseFromFile(@"NextSyncUrl.json");

            //Act
            var res = await _client.SyncNextResultAsync("SomeSyncToken");

            //Assert
            Assert.Null(res.NextPageUrl);
            Assert.Equal("https://cdn.contentful.com/spaces/n9r7gd2bwvqt/sync?sync_token=nexttoken", res.NextSyncUrl);
            Assert.Equal(1, res.Assets.Count());
            Assert.Equal(1, res.Entries.Count());
            Assert.Equal(0, res.DeletedAssets.Count());
            Assert.Equal(0, res.DeletedEntries.Count());
            Assert.Equal("6dbjWqNd9SqccegcqYq224", res.Entries.First().SystemProperties.Id);
            Assert.Equal("Whisk Beater - updated and improved!", res.Entries.First().Fields.productName["en-US"].ToString());
            Assert.Equal("Smisk slagare", res.Entries.First().Fields.productName.sv.ToString());
            Assert.Equal(34250, int.Parse(res.Assets.First().Fields.file["en-US"].details.size.ToString()));
        }