public async Task InitializeAsync() { var designDocs = new DesignDocConfig[] { new DesignDocConfig() { Name = "list", Views = new View[] { new View() { Name = "only-bazs-greater-than-10", MapFunction = @"function (doc) { if (doc.Baz > 10) { emit(doc._id, doc); } }", ReduceFunction = "_count" } } } }; var config = new Configuration("http://localhost:5984", "davenport_net"); config.Warning += (object sender, string message) => Console.WriteLine(message); // Make sure the database exists Client = await Configuration.ConfigureDatabaseAsync <MyTestClass>(config, designDocs : designDocs); }
public async Task ShouldConfigure() { var designDocs = new DesignDocConfig[] { new DesignDocConfig() { Name = "list", Views = new View[] { new View() { Name = "only-bazs-greater-than-10", MapFunction = @"function (doc) { if (doc.Baz > 10) { emit(doc._id, doc); } }", ReduceFunction = "_count" } } } }; Client <MyTestClass> client; try { client = await Configuration.ConfigureDatabaseAsync <MyTestClass>(Config, new string[] { "Foo" }, designDocs); } catch (DavenportException ex) { Console.WriteLine(ex.ResponseBody); throw; } Assert.True(client != null); }