Beispiel #1
0
        public async Task AsyncWhatIsChangesApi()
        {
            using (var store = new DocumentStore())
            {
                #region changes_2
                IDatabaseChanges changes = store.Changes();
                await changes.EnsureConnectedNow();

                var subscription = changes
                                   .ForAllDocuments()
                                   .Subscribe(change => Console.WriteLine("{0} on document {1}", change.Type, change.Id));
                try
                {
                    // application code here
                }
                finally
                {
                    if (subscription != null)
                    {
                        subscription.Dispose();
                    }
                }
                #endregion
            }
        }
Beispiel #2
0
        private async Task AssertChangesApiTaskFailure(IDatabaseChanges changes)
        {
            Task <IDatabaseChanges> changesTask = null;

            Assert.Equal(TaskStatus.Faulted, await WaitForValueAsync(() =>
            {
                changesTask = changes.EnsureConnectedNow();
                return(changesTask.Status);
            }, TaskStatus.Faulted));
            Assert.NotNull(changesTask.Exception.InnerException);
            Assert.Equal(typeof(DatabaseDoesNotExistException), changesTask.Exception.InnerException.GetType());
        }