public void Query() { var data = new List <Widget>(); for (var i = 0; i < 10; i++) { data.Add(new Widget { Description = "A widget", Expiration = DateTime.Now.AddYears(1), Name = "Widget", Price = 9.99m, Size = i }); } var widgets = new MongoyList <Widget>(Host, Database, Collection); widgets.Add(data); var query = from w in widgets where w.Size > 5 && w.Size < 8 select w; Assert.Equal(2, query.Count()); }
public void Delete() { var widget = new Widget() { Description = "A widget", Expiration = DateTime.Now.AddYears(1), Name = "Widget", Price = 9.99m, Size = 2 }; var widgets = new MongoyList<Widget>(Host, Database, Collection); widgets.Add(widget); widgets.Remove(widget); Assert.Equal(0, _dbVerifier.Count()); }
public void Delete() { var widget = new Widget() { Description = "A widget", Expiration = DateTime.Now.AddYears(1), Name = "Widget", Price = 9.99m, Size = 2 }; var widgets = new MongoyList <Widget>(Host, Database, Collection); widgets.Add(widget); widgets.Remove(widget); Assert.Equal(0, _dbVerifier.Count()); }
public void Update() { var widget = new Widget() { Description = "A widget", Expiration = DateTime.Now.AddYears(1), Name = "Widget", Price = 9.99m, Size = 2 }; var widgets = new MongoyList <Widget>(Host, Database, Collection); widgets.Add(widget); widget.Name = "I updated this!!"; widgets.Flush(); var updatedWidget = _dbVerifier.Find(widget.Id); Assert.Equal(widget.Name, updatedWidget.Name); }
public void WriteALot() { var data = new List <Widget>(); for (var i = 0; i < 10000; i++) { data.Add(new Widget { Description = "A widget", Expiration = DateTime.Now.AddYears(1), Name = "Widget", Price = 9.99m, Size = i }); } var widgets = new MongoyList <Widget>(Host, Database, Collection); widgets.Add(data); Assert.Equal(data.Count, widgets.Count); Assert.Equal(data.Count, _dbVerifier.Count()); }
public void Query() { var data = new List<Widget>(); for (var i = 0; i < 10; i++) { data.Add(new Widget { Description = "A widget", Expiration = DateTime.Now.AddYears(1), Name = "Widget", Price = 9.99m, Size = i }); } var widgets = new MongoyList<Widget>(Host, Database, Collection); widgets.Add(data); var query = from w in widgets where w.Size > 5 && w.Size < 8 select w; Assert.Equal(2, query.Count()); }
public void WriteALot() { var data = new List<Widget>(); for (var i = 0; i < 10000; i++) { data.Add(new Widget { Description = "A widget", Expiration = DateTime.Now.AddYears(1), Name = "Widget", Price = 9.99m, Size = i }); } var widgets = new MongoyList<Widget>(Host, Database, Collection); widgets.Add(data); Assert.Equal(data.Count, widgets.Count); Assert.Equal(data.Count, _dbVerifier.Count()); }
public void Update() { var widget = new Widget() { Description = "A widget", Expiration = DateTime.Now.AddYears(1), Name = "Widget", Price = 9.99m, Size = 2 }; var widgets = new MongoyList<Widget>(Host, Database, Collection); widgets.Add(widget); widget.Name = "I updated this!!"; widgets.Flush(); var updatedWidget = _dbVerifier.Find(widget.Id); Assert.Equal(widget.Name, updatedWidget.Name); }