Esempio n. 1
0
        private async Task ApplyEntityViews(ObservableCollection <EntityModel> models)
        {
            await SaveModelState <EntityModel>("entitymodels", models);

            var entityTemplate = "['{0}', '{1}', '{2}']";
            var js             = models.Select(m => string.Format(entityTemplate, m.Field, m.Name, m.TimeField)).Aggregate((s1, s2) => s1 + "," + s2);

            using (StreamReader sr = new StreamReader("entities.json"))
            {
                var designDocTemplate = await sr.ReadToEndAsync();

                var designDoc = designDocTemplate.Replace("{0}", js);
                var res       = await _manager.UpdateDesignDocumentAsync("entities", designDoc);

                if (res.Success)
                {
                    MessageBox.Show("Entity indexing updated.");
                }
            }
        }
        public async Task UpdateDesignDocumentAsync_DoesNotExist_Success()
        {
            // Arrange

            // ensure that the design document doesn't exist (ignore failure)
            await _bucketManager.RemoveDesignDocumentAsync("test");

            // Act

            var result = await _bucketManager.UpdateDesignDocumentAsync("test", JsonConvert.SerializeObject(DesignDoc));

            // Assert

            Assert.NotNull(result);
            Assert.True(result.Success);

            // Cleanup

            var removeResult = await _bucketManager.RemoveDesignDocumentAsync("test");

            Assert.True(removeResult.Success);
        }
Esempio n. 3
0
 public void UpdateDesignDocumentAsyn_Throws_NotSupportedException()
 {
     Assert.Throws <NotSupportedException>(() => _bucketManager.UpdateDesignDocumentAsync(It.IsAny <string>(), It.IsAny <string>()));
 }