Exemplo n.º 1
0
        public async Task EmptyBackup()
        {
            var sourceContainer = await CosmosCollectionRental.GetCollectionAsync("empty");

            var targetContainer = await CosmosCollectionRental.GetCollectionAsync(sourceContainer.Id + "-restore");

            await BackupAsync(sourceContainer);
            await RestoreAsync(sourceContainer, targetContainer);

            await CollectionComparer.CompareDocumentCountAsync(sourceContainer, targetContainer);
        }
Exemplo n.º 2
0
        public async Task MultipleDocsWithMultipleBackupsDocument()
        {
            var sourceContainer = await CosmosCollectionRental.GetCollectionAsync("MultipleDocsWithMultipleBackupsDocument");

            var targetContainer = await CosmosCollectionRental.GetCollectionAsync(sourceContainer.Id + "-restore");

            await sourceContainer.CreateItemAsync(new
            {
                id      = "test",
                name    = "John",
                age     = 40,
                address = new
                {
                    street = "Baker",
                    number = "221B"
                }
            });

            await BackupAsync(sourceContainer);

            await sourceContainer.CreateItemAsync(new
            {
                id   = "test2",
                name = "Jim",
                age  = 40.5
            });

            await BackupAsync(sourceContainer);

            await sourceContainer.CreateItemAsync(new
            {
                id        = "test3",
                name      = "Bill",
                age       = 40,
                isMarried = true
            });

            await BackupAsync(sourceContainer);
            await RestoreAsync(sourceContainer, targetContainer);

            await CollectionComparer.CompareDocumentsAsync(sourceContainer, targetContainer);
        }
Exemplo n.º 3
0
        public async Task OneDocument()
        {
            var sourceContainer = await CosmosCollectionRental.GetCollectionAsync("one-document");

            var targetContainer = await CosmosCollectionRental.GetCollectionAsync(sourceContainer.Id + "-restore");

            await sourceContainer.CreateItemAsync(new
            {
                id      = "test",
                name    = "John",
                age     = 40,
                address = new
                {
                    street = "Baker",
                    number = "221B"
                },
                skills = new[] { "jumping", "walking" }
            });

            await BackupAsync(sourceContainer);
            await RestoreAsync(sourceContainer, targetContainer);

            await CollectionComparer.CompareDocumentsAsync(sourceContainer, targetContainer);
        }