Beispiel #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);
        }
Beispiel #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);
        }
Beispiel #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);
        }
Beispiel #4
0
 void IDisposable.Dispose()
 {
     CosmosCollectionRental.DeleteDatabaseAsync().Wait();
 }