public void FixtureSetup() { _cx = ConnectionTests.CreateConnection(); if (_cx.ListDatabases().Contains("relax-repository-tests")) { _cx.DeleteDatabase("relax-repository-tests"); } _cx.CreateDatabase("relax-repository-tests"); _sx = _cx.CreateSession("relax-repository-tests"); _sx2 = _cx.CreateSession("relax-repository-tests"); _sx.Save(new Gizmo { Name = "Widget", Cost = 30, Manufacturer = "ACME" }); _sx.Save(new Gizmo { Name = "Gadget", Cost = 30, Manufacturer = "ACME" }); _sx.Save(new Gizmo { Name = "Foo", Cost = 35, Manufacturer = "ACME" }); _sx.Save(new Gizmo { Name = "Bar", Cost = 35, Manufacturer = "Widgetco" }); _sx.Save(new Gizmo { Name = "Biz", Cost = 45, Manufacturer = "Widgetco" }); _sx.Save(new Gizmo { Name = "Bang", Cost = 55, Manufacturer = "Widgetco" }); }
public void FixtureSetup() { _cx = ConnectionTests.CreateConnection(); if (_cx.ListDatabases().Contains("relax-observer-tests")) { _cx.DeleteDatabase("relax-observer-tests"); } _cx.CreateDatabase("relax-observer-tests"); }
public void Connection_fills_session_observers() { var cx = ConnectionTests.CreateConnection(); cx.Observers.Add(x => new MockObserver()); var sx = cx.CreateSession("relax-observer-tests"); Assert.That(sx.Observers.Count, Is.EqualTo(1)); }
public void FixtureSetup() { _cx = ConnectionTests.CreateConnection(); if (_cx.ListDatabases().Contains("relax-session-tests")) { _cx.DeleteDatabase("relax-session-tests"); } _cx.CreateDatabase("relax-session-tests"); _sx = _cx.CreateSession("relax-session-tests"); // create an initial document on a seperate session var x = _cx.CreateSession(_sx.Database); var w = new Widget { Name = "gizmo", Tags = new[] { "whizbang", "geegollie" } }; _doc = x.Save(w); }
public void FixtureSetup() { _cx = ConnectionTests.CreateConnection(); if (_cx.ListDatabases().Contains("relax-reference-tests")) { _cx.DeleteDatabase("relax-reference-tests"); } _cx.CreateDatabase("relax-reference-tests"); _sx = _cx.CreateSession("relax-reference-tests"); _sx2 = _cx.CreateSession("relax-reference-tests"); _sx.Save(new Widget { Id = "w1", Name = "Widget", Cost = 30 }); _sx.Save(new Widget { Id = "w2", Name = "Gadget", Cost = 30 }); _sx.Save(new Widget { Id = "w3", Name = "Foo", Cost = 35 }); _sx.Save(new Widget { Id = "w4", Name = "Bar", Cost = 35 }); _sx.Save(new Widget { Id = "w5", Name = "Biz", Cost = 45 }); _sx.Save(new Widget { Id = "w6", Name = "Bang", Cost = 55 }); _sx.SaveRaw(JObject.Parse( @"{ _id: 'g1', Name: 'Gadget #1', Primary: 'w1' }")); _sx.SaveRaw(JObject.Parse( @"{ _id: 'g2', Name: 'Gadget #1', Secondary: ['w1', 'w2', 'w3'] }")); }
public void FixtureSetup() { _cx = ConnectionTests.CreateConnection(); if (_cx.ListDatabases().Contains("relax-query-tests")) { _cx.DeleteDatabase("relax-query-tests"); } _cx.CreateDatabase("relax-query-tests"); _sx = _cx.CreateSession("relax-query-tests"); // populate a few widgets & a simple design doc _sx.Save(new Widget { Name = "widget", Manufacturer = "acme" }); _sx.Save(new Widget { Name = "sprocket", Manufacturer = "acme" }); _sx.Save(new Widget { Name = "doodad", Manufacturer = "widgetco" }); _sx.Save( new DesignDocument { Language = "javascript", Views = new Dictionary <string, View> { { "all-widgets", new View { Map = @"function(doc) { emit(null, null); }" } }, { "all-manufacturers", new View() { Map = @"function(doc) { emit(doc.Manufacturer, 1); }", Reduce = @"function(keys, values, rereduce) { return sum(values); }" } } } }, "_design/widgets" ); }